Skip to content

Commit

Permalink
feat: add the index page parameter for indexing the page in client …
Browse files Browse the repository at this point in the history
…search engine or not
  • Loading branch information
razonyang committed Nov 22, 2022
1 parent 7cc4320 commit 8bfb4f4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Page parameters are located in page's [Front Matter](https://gohugo.io/content-m
| `carousel` | Boolean | `false` | Show on carousel.
| `nav` | Boolean | `true` | Turn on/off the navigations.
| `sidebar` | Boolean | `true` | Show/Hide the sidebar.
| `index` | Boolean | `true` | Index this page in client search engine or not.
| **Creative Commons License**
| `creativeCommons` | Object | - |
| `creativeCommons.by` | Boolean | `true` | Credit must be given to you, the creator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ authors = ["RazonYang"]
| `carousel` | Boolean | `false` | 是否在 Carousel 显示
| `nav` | Boolean | `true` | 是否显示上一篇和下一篇
| `sidebar` | Boolean | `true` | Show/Hide the sidebar.
| `index` | Boolean | `true` | 是否在客户端搜索引擎中索引此页面。
| **Creative Commons License**
| `creativeCommons` | Object | - |
| `creativeCommons.by` | Boolean | `true` | 署名
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ authors = ["RazonYang"]
| `carousel` | Boolean | `false` | 是否在 Carousel 顯示
| `nav` | Boolean | `true` | 是否顯示上一篇和下一篇
| `sidebar` | Boolean | `true` | Show/Hide the sidebar.
| `index` | Boolean | `true` | 是否在用戶端搜尋引擎中索引此頁面。
| **Creative Commons License**
| `creativeCommons` | Object | - |
| `creativeCommons.by` | Boolean | `true` | 署名
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/search/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
{{- $min := sub $max $paginate }}
{{- $scratch.Add "pages" slice -}}
{{- $counter := 0 }}
{{- range where .Site.AllPages "Kind" "page" -}}
{{- $pages := where (where .Site.AllPages "Kind" "page") "Params.index" "ne" false -}}
{{- range $pages -}}
{{- if and (ge $counter $min) (lt $counter $max) }}
{{- $page := . }}
{{- $date := .Date | time.Format ":date_long" -}}
Expand Down

0 comments on commit 8bfb4f4

Please sign in to comment.