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

feat: add sectionsTitles parameter #310

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

davlgd
Copy link
Contributor

@davlgd davlgd commented Feb 27, 2024

If the website is composed of multiple sections, we could want to define different titles templates for each of them. For example:

  • documentation: Title - My documentation
  • blog: Title - My blog
  • guides: Title - My guides

With this PR, the user can define a new entry params, sectionsTitles to define per section title, used in the title of section pages. If none is defined, the default title is used.

Example:

title: My documentation

params:
  sectionTitles: 
    blog: My blog
    guides: My guides

Copy link

netlify bot commented Feb 27, 2024

Deploy Preview for hugo-hextra ready!

Name Link
🔨 Latest commit f66c915
🔍 Latest deploy log https://app.netlify.com/sites/hugo-hextra/deploys/65dd7e237384fa00080f437f
😎 Deploy Preview https://deploy-preview-310--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.

The user can define a per section title in params, used in section pages. If none is defined, the default title is used.
@imfing imfing added the enhancement New feature or request label Mar 1, 2024
@imfing imfing added this to the v0.8.0 milestone Mar 1, 2024
@imfing imfing removed this from the v0.8.0 milestone Apr 1, 2024
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.

thanks! we need to take into account that our site supports multiple languages.
the current approach might not work for multi-language sites. we should probably figure out a different approach.

@davlgd
Copy link
Contributor Author

davlgd commented Apr 2, 2024

thanks! we need to take into account that our site supports multiple languages. the current approach might not work for multi-language sites. we should probably figure out a different approach.

For multi-languages it works too, you just have to put sectionTitles in a languages > lang code > params section. For example for a french version of above parameters:

languages:
  fr:
    params: 
      sectionTitles: 
        blog: Mon blog
        guides: Mes guides

As mentionned in Hugo documentation (v0.112.0+):
https://gohugo.io/content-management/multilingual/#changes-in-hugo-01120

@davlgd davlgd requested a review from imfing April 2, 2024 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants