Skip to content

Conversation

@MattDodsonEnglish
Copy link
Contributor

This param completely blocks a page or directory from being indexed on Google. Useful for avoiding indexing duplicate content or any other page that shouldn't appear in search results.

  • Adjust head.html for optional noindex param, make default value false
  • Document use in configuration.md. I also modified the Flexsearch section to be explicit about what "search index" means on different parts of the page.

@netlify
Copy link

netlify bot commented Apr 21, 2025

Deploy Preview for hugo-hextra ready!

Name Link
🔨 Latest commit 8d83c37
🔍 Latest deploy log https://app.netlify.com/sites/hugo-hextra/deploys/681cc88a31a43f00094ae1c4
😎 Deploy Preview https://deploy-preview-671--hugo-hextra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@MattDodsonEnglish
Copy link
Contributor Author

By the way, I tested the mod on my fork, and the logic is currently used aon https://docs.rhize.com :
https://github.com/libremfg/rhize-docs/blob/main/layouts/partials/head.html#L4,

At time of writing, though, only draft pages at content/versions have noindex. So all published pages on site have index, follow (i.e. the default works). It would be bad to make a mistake.

@imfing imfing requested a review from Copilot April 28, 2025 23:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds an optional "noindex" parameter in page front matter to block Google indexing, and updates both the theme's head template and documentation accordingly.

  • Introduces a new variable in head.html to control the robots meta tag based on the "noindex" parameter.
  • Updates the documentation in configuration.md to explain how to use the parameter, and renames the "Search Index" heading to "FlexSearch Index" for clarity.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
layouts/partials/head.html Adjusts meta tag logic to conditionally render index/follow tags.
exampleSite/content/docs/guide/configuration.md Updates documentation to include the new noindex configuration and improves heading clarity.


```yaml
title: Configuration (archive version)
noindex: true
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put it under params?

https://gohugo.io/methods/page/param/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, just updated. 8d83c37

Never knew that was the recommended way.

@MattDodsonEnglish
Copy link
Contributor Author

To test locally:

  1. Add the param to one of the pages in exampleSite
params:
  noindex: true
  1. Build exampleSite with hugo server --environment "production" and check the HTML source for that page.

Copy link
Owner

@imfing imfing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@imfing imfing merged commit 128235e into imfing:main May 17, 2025
4 checks passed
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 this pull request may close these issues.

2 participants