You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was struggling with an issue where I wanted to host a document on my website, but I didn't want it to be accessible by normal navigation. I wanted it available only by link.
That's easy enough - just throw a page into /content/my-private-folder/ and don't add site navigation to it anywhere.
But a problem I found is that the document still appeared in the rss output, an undesirable behavior.
My quick solution was to use Hugo's built-in hidden = true param to the front matter of the page and add a check for the param in the theme's rss layout. Like so --
{{- range $pages }}
{{- if and (not .Params.hidden) (ne .Layout `search`) (ne .Layout `archives`) }}
<item>
... item rss info here ...
</item>
{{- end }}
{{- end }}
Is this hacky, or would this actually be a decent solution for the theme?
And are there other locations that hidden should provide this kind of behavior?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I was struggling with an issue where I wanted to host a document on my website, but I didn't want it to be accessible by normal navigation. I wanted it available only by link.
That's easy enough - just throw a page into
/content/my-private-folder/
and don't add site navigation to it anywhere.But a problem I found is that the document still appeared in the rss output, an undesirable behavior.
My quick solution was to use Hugo's built-in
hidden = true
param to the front matter of the page and add a check for the param in the theme's rss layout. Like so --Is this hacky, or would this actually be a decent solution for the theme?
And are there other locations that
hidden
should provide this kind of behavior?Beta Was this translation helpful? Give feedback.
All reactions