chipzoller / hugo-clarity

A theme for Hugo based on VMware Clarity
Other
577 stars 262 forks source link

add noindex parameter #466

Closed stdevel closed 4 months ago

stdevel commented 5 months ago

This PR adds the possibility to set the noindex meta parameter in order to preventing search engine from indexing a particular post or page.

To enable it, the following line needs to be added to the front matter:

noindex: true

Successfully tested on one of my websites.

Pull Request type

Current state

All pages or posts can be indexed by search engines.

Issue Number(s): #465

Proposed changes

It adds a parameter noindex that can be set in the front matter. If set, the following HTML meta tag is set:

<meta name="robots" content="noindex" />

Screenshots, if applicable

grafik

Checklist

I work consistent with the Developer Certificate of Origin.

rterakedis commented 5 months ago

Hello @stdevel,

It looks like you added "noindex" in the Site Params section in the README file (i.e. .Site.Params.noindex). However, in the partial you've referenced the Page params (from the front matter of a page): {{ if .Params.noindex }}

You may need to move the row in the README table down into the Page Params section if that's the intent of the partial.

stdevel commented 4 months ago

Hi @rterakedis, you're so right - thanks for pointing out!

I added another commit to fix this. Let me know if this works for you now.