Skip to content

Search function to look in title, content, tags and categories #141

Answered by adityatelange
kmunkholm asked this question in Q&A
Discussion options

You must be logged in to vote

@kmunkholm Take a look here

{{- $.Scratch.Add "index" slice -}}
{{- range .Site.RegularPages -}}
{{- $.Scratch.Add "index" (dict "title" .Title "content" .Plain "permalink" .Permalink "summary" .Summary) -}}
{{- end -}}
{{- $.Scratch.Get "index" | jsonify -}}

This is the index where search searches for into,
namely

  • title
  • content
  • url
  • summary

It does search in content, although
It does not search in Taxonomies i.e Tags / Categories.
keys used can be some, all or none from ["title", "permalink", "summary", "content"] , but cannot be more unless you ovveride index.json

refer commit m…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@kmunkholm
Comment options

Answer selected by adityatelange
Comment options

You must be logged in to vote
3 replies
@adityatelange
Comment options

@adityatelange
Comment options

@kmunkholm
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants