Skip to content

Commit

Permalink
Content: added extra front-matter options to example page
Browse files Browse the repository at this point in the history
- Added possible front-matter options to example page
(/examples/basic/front-matter/)
- Fixed front-matter typo in head.html + sitemap.xml
- Fixed the same typo on the blog pages

For https://linear.app/usmedia/issue/CUE-340

Closes #442 as merged as of commit 3df48eb.

Preview-Path: /examples/basic/front-matter/
Signed-off-by: Anne van Gorkom <[email protected]>
Change-Id: Ia41193e348387ba832cca63fd013263df9f19f4b
Dispatch-Trailer: {"type":"trybot","CL":1172301,"patchset":1,"ref":"refs/changes/01/1172301/1","targetBranch":"alpha"}
  • Loading branch information
anne-usmedia authored and cueckoo committed Nov 17, 2023
1 parent d2cfc31 commit deb0a57
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 14 deletions.
2 changes: 1 addition & 1 deletion content/blog/example/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Example blog page and also a longer title
date: "2023-04-06"
draft: false
noindex: true
no_index: true
image: "cow.jpg"
authors:
- myitcv
Expand Down
2 changes: 1 addition & 1 deletion content/blog/example2/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Example blog page 2 with a longer title
date: "2023-01-01"
draft: false
noindex: true
no_index: true
image: "allium.jpg"
---

Expand Down
2 changes: 1 addition & 1 deletion content/blog/example3/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Example blog page 3
date: "2023-03-10"
draft: false
noindex: true
no_index: true
image: "moon.jpg"
---

Expand Down
2 changes: 1 addition & 1 deletion content/blog/example4/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Example blog page 4
date: "2023-03-10"
draft: false
noindex: true
no_index: true
image: "birds.jpg"
---

Expand Down
26 changes: 24 additions & 2 deletions content/examples/basic/front-matter/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,27 @@ tags:
authors
: adding the author(s) to the frontmatter, makes the content header show an image + name of the assigned author. It also shows a popup on click, with again an image + (display) name, and when available a link to their Github, and a link to the search page so users can search for other articles of this author.

noindex
: adding noindex: true to the front-matter add the meta tag `<meta name="robots" content="noindex, nofollow">` to the head of the page. Also the pages will be excluded from the sitemap.xml.
no_index
: adding `no_index: true` to the front-matter adds the meta tag `<meta name="robots" content="noindex, nofollow">` to the head of the page. Also the pages will be excluded from the sitemap.xml.

## Docs specific front-matter

disabled
: shows page without the content, but with a TODO block

hide_summary
: adding `hide_summary: true` will remove the page from the list on a docs overview page (eg. /docs/howto). It will still show in the left hand nav, and the prev/next buttons.

index_hide
: adding `index_hide: true` will hide the list of children on a docs overview page (eg. /docs/howto)

toc_hide
: `toc_hide: true` will hide the table of contents in the left hand nav

toc_root
: `toc_root: true` will set the page as the parent, hiding all other levels of the left hand nav. The left hand nav will only show the (grand)children of the page.

## Blog specific front-matter

image
: adds a header image to the blog page. Also shows in the blog teaser.
2 changes: 1 addition & 1 deletion hugo/content/en/blog/example/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Example blog page and also a longer title
date: "2023-04-06"
draft: false
noindex: true
no_index: true
image: "cow.jpg"
authors:
- myitcv
Expand Down
2 changes: 1 addition & 1 deletion hugo/content/en/blog/example2/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Example blog page 2 with a longer title
date: "2023-01-01"
draft: false
noindex: true
no_index: true
image: "allium.jpg"
---

Expand Down
2 changes: 1 addition & 1 deletion hugo/content/en/blog/example3/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Example blog page 3
date: "2023-03-10"
draft: false
noindex: true
no_index: true
image: "moon.jpg"
---

Expand Down
2 changes: 1 addition & 1 deletion hugo/content/en/blog/example4/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Example blog page 4
date: "2023-03-10"
draft: false
noindex: true
no_index: true
image: "birds.jpg"
---

Expand Down
26 changes: 24 additions & 2 deletions hugo/content/en/examples/basic/front-matter/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,27 @@ tags:
authors
: adding the author(s) to the frontmatter, makes the content header show an image + name of the assigned author. It also shows a popup on click, with again an image + (display) name, and when available a link to their Github, and a link to the search page so users can search for other articles of this author.

noindex
: adding noindex: true to the front-matter add the meta tag `<meta name="robots" content="noindex, nofollow">` to the head of the page. Also the pages will be excluded from the sitemap.xml.
no_index
: adding `no_index: true` to the front-matter adds the meta tag `<meta name="robots" content="noindex, nofollow">` to the head of the page. Also the pages will be excluded from the sitemap.xml.

## Docs specific front-matter

disabled
: shows page without the content, but with a TODO block

hide_summary
: adding `hide_summary: true` will remove the page from the list on a docs overview page (eg. /docs/howto). It will still show in the left hand nav, and the prev/next buttons.

index_hide
: adding `index_hide: true` will hide the list of children on a docs overview page (eg. /docs/howto)

toc_hide
: `toc_hide: true` will hide the table of contents in the left hand nav

toc_root
: `toc_root: true` will set the page as the parent, hiding all other levels of the left hand nav. The left hand nav will only show the (grand)children of the page.

## Blog specific front-matter

image
: adds a header image to the blog page. Also shows in the blog teaser.
2 changes: 1 addition & 1 deletion hugo/layouts/_default/sitemap.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range where (where .Data.Pages "Type" "!=" "examples") "Params.noindex" "ne" true }}
{{ range where (where .Data.Pages "Type" "!=" "examples") "Params.no_index" "ne" true }}
{{- if .Permalink -}}
<url>
<loc>{{ .Permalink }}</loc>
Expand Down
2 changes: 1 addition & 1 deletion hugo/layouts/partials/site/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{{ else }}{{ with .Site.Params.description -}}{{- . | $.RenderString | plainify -}}
{{ end }}{{ end }}{{ end -}}">
{{ hugo.Generator }}
{{ if and (eq (getenv "HUGO_ENV") "production") (ne .Params.noindex true) (ne .Type "examples") }}
{{ if and (eq (getenv "HUGO_ENV") "production") (ne .Params.no_index true) (ne .Type "examples") }}
<meta name="robots" content="index, follow">
{{ else }}
<meta name="robots" content="noindex, nofollow">
Expand Down

0 comments on commit deb0a57

Please sign in to comment.