Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude individual pages from the search index #816

Closed
h-enk opened this issue Jul 5, 2022 · 2 comments · Fixed by #1043
Closed

Exclude individual pages from the search index #816

h-enk opened this issue Jul 5, 2022 · 2 comments · Fixed by #1043

Comments

@h-enk
Copy link
Member

h-enk commented Jul 5, 2022

For reference if interested, I've got a modified version of this which can exclude individual pages from the index:

---
title: "A Title"
description: "A Description"
lead: ""
date: 2022-03-20T12:52:27+11:00
draft: false
images: []
weight: 600
search:
  index: false
---
  {{ $list := slice }}
  {{- if and (isset .Site.Params.options "searchsectionsindex") (not (eq (len .Site.Params.options.searchSectionsIndex) 0)) }}
  {{- if eq .Site.Params.options.searchSectionsIndex "ALL" }}
  {{- $list = .Site.Pages }}
  {{- else }}
  {{- $list = (where (where .Site.Pages "Type" "in" .Site.Params.options.searchSectionsIndex) ".Params.search.index" "!=" "false") }}
  {{- if (in .Site.Params.options.searchSectionsIndex "HomePage") }}
  {{ $list = $list | append .Site.Home }}
  {{- end }}
  {{- end }}
  {{- else }}
  {{- $list = (where .Site.Pages "Section" "docs") }}
  {{- end }}

  {{ $len := (len $list) -}}

Originally posted by @james-d-elliott in #799 (comment)

@james-d-elliott
Copy link
Contributor

Considering you posted this here, do you want this implemented? It's a fairly minor tweak and could theoretically be extended later to have other per-page search settings.

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Aug 17, 2022
@h-enk h-enk added keep and removed stale labels Aug 18, 2022
@h-enk h-enk linked a pull request Apr 18, 2023 that will close this issue
4 tasks
@h-enk h-enk added this to the v1.0.0 milestone Apr 18, 2023
@h-enk h-enk closed this as completed Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants