From 1daedcb3c4f811c1e887c6ec33c608b333d29cc7 Mon Sep 17 00:00:00 2001 From: Bill Stumbo Date: Thu, 20 Aug 2026 22:40:16 -0400 Subject: [PATCH] Set Bibliography Index page to noindex Search results currently favor the bibliography index page listing all the items in the bibliography. These changes set this page to noindex, follow instructing robots not to index the page but to index the child pages. This will help surface the individual pages when searches are performed on items covered in bibliographic entries. - Add a new tag to the bibliography _index.md page setting it to noindex, follow - Add code to head-end.html to recognize front matter tag and enscribe the appropriate value into the generated page - Add data-nosnippet around preview text in generated bibliography entries on the index page. This is a secondary change that tells a search engine not to use the preview text in returned results. Given we don't want the page indexed, it may be overkill. - Add page level no-index information to sitemap. --- content/en/history/bibliography/_index.md | 1 + layouts/_partials/hooks/head-end.html | 8 ++++++++ layouts/bibliography/list.html | 4 ++-- layouts/sitemap.xml | 2 ++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/content/en/history/bibliography/_index.md b/content/en/history/bibliography/_index.md index 4a4998312..b9c2823ff 100644 --- a/content/en/history/bibliography/_index.md +++ b/content/en/history/bibliography/_index.md @@ -2,6 +2,7 @@ title: Bibliography heading: Interlisp Bibliography type: bibliography +robots: "noindex, follow" cascade: type: bibliography toc_hide: true diff --git a/layouts/_partials/hooks/head-end.html b/layouts/_partials/hooks/head-end.html index f800ce9ff..14f526e3c 100644 --- a/layouts/_partials/hooks/head-end.html +++ b/layouts/_partials/hooks/head-end.html @@ -1,3 +1,11 @@ +{{- /* Emit a page-level robots directive when front matter sets `robots`. + Docsy's head.html already emits "index, follow" for production pages; + when both tags are present, search engines apply the most restrictive + rule, so a `noindex` value here wins. See the bibliography section's + _index.md. */ -}} +{{ with .Params.robots }} + +{{ end }} {{ partial "bibliography-json-ld.html" . }} diff --git a/layouts/bibliography/list.html b/layouts/bibliography/list.html index 68cd602df..47b6334b1 100644 --- a/layouts/bibliography/list.html +++ b/layouts/bibliography/list.html @@ -107,9 +107,9 @@

{{ or .Params.heading .Title }}

{{- $previewing := gt (countwords $plain) $previewWordLimit -}} {{- if $previewing }} {{- $previewWords := split $plain " " | first $previewWordLimit -}} -
{{ delimit $previewWords " " | safeHTML }}…
+
{{ delimit $previewWords " " | safeHTML }}…
{{- else }} -
{{ replace (. | htmlEscape) "\n" "
" | safeHTML }}
+
{{ replace (. | htmlEscape) "\n" "
" | safeHTML }}
{{- end }} {{ end }} diff --git a/layouts/sitemap.xml b/layouts/sitemap.xml index 226bee190..ab0b33f66 100644 --- a/layouts/sitemap.xml +++ b/layouts/sitemap.xml @@ -2,6 +2,7 @@ {{ range (where .Data.Pages "Type" "!=" "redirect") }} + {{- if not (strings.Contains (.Params.robots | default "") "noindex") }} {{ .Permalink }}{{ if not .Lastmod.IsZero }} {{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}{{ end }}{{ with .Sitemap.ChangeFreq }} @@ -18,5 +19,6 @@ href="{{ .Permalink }}" />{{ end }} + {{- end }} {{ end }}