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

Feature Request: Add default permalink format configuration setting #4641

Open
theory opened this issue Apr 18, 2018 · 12 comments
Open

Feature Request: Add default permalink format configuration setting #4641

theory opened this issue Apr 18, 2018 · 12 comments
Labels
Milestone

Comments

@theory
Copy link
Contributor

theory commented Apr 18, 2018

Following up on this Discourse topic, I'd like to request a method, perhaps a global config setting, to set the default permalink format. That is, if there is no entry for a section in the [permalinks] config, it would fall back on this new setting. Currently, it appears to be hard-coded to /:slug/.

theory added a commit to theory/justatheory that referenced this issue May 14, 2018
Otherwise the URL format does not work. See gohugoio/hugo#4641
for a feature request to fix.
@stale
Copy link

stale bot commented Aug 16, 2018

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@stale stale bot added the Stale label Aug 16, 2018
@theory
Copy link
Contributor Author

theory commented Aug 16, 2018

I think this issue is relevant and valuable because, without the requested feature, one must create a separate permalinks entry for each section of the site. If one adds a new section and forgets, one might end up with a URL one doesn't want. It's nice to have the ability to set the default rather than rely on a hard-coded default.

@stale stale bot removed the Stale label Aug 16, 2018
@stale
Copy link

stale bot commented Dec 14, 2018

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@stale stale bot added the Stale label Dec 14, 2018
@stale stale bot removed the Stale label Dec 14, 2018
@theory
Copy link
Contributor Author

theory commented Dec 17, 2018

Thanks for keeping this alive, @moorereason.

@nstickney
Copy link

... I also heartily support this issue.

@rafed
Copy link

rafed commented Apr 19, 2020

Come on.... this needs to be done...

@rawtaz
Copy link

rawtaz commented May 17, 2020

I was just about to create a new issue with this very same feature enhancement request, but managed to find an existing one first. I have the same situation, we'll be using the same URL format for all posts on the site, regardless of section. It doesn't make sense to redundantly specify the same configuration directive for every section, and take the risk of publishing incorrectly formatted URLs in case you'd forget to reconfigure things when you add a new section for your posts, as these may end up used by others.

@kaktusakCZ
Copy link

I also heartily support this issue.

@jmooring
Copy link
Member

For all the sites currently built with Hugo...

  1. On average, what is the number of content types (top level sections)? I suspect the average is around 3.
  2. Of those top level sections, how many have/need/want a permalink setting? I suspect the average is much less than 1.

Setting a default if you only have one section that needs a permalink setting doesn't buy you anything.

@rawtaz
Copy link

rawtaz commented May 11, 2023

Even if the case is that one has just a single section, this doesn't mean that a default setting wouldn't be useful, since when adding additional sections this default setting would then be used, which means less redundancy and less risk of generating wrong permalinks.

Also, having permalink settings is used/can be needed when you migrate a site from an older system and you want to keep the same URL format (that does not match the default in Hugo).

With this in mind, I'd say the suggestion is still relevant.

@ytrepidorosonomous
Copy link

I am with Joe here. The default option works well for most sites (I think). I would hate, as a beginner, to find my URLs changed when porting a site to Hugo, maybe without knowing they are set in config, and having to dig up through multiple files and hours to figure this out. At least with the default setting, I am aware it is using directory path.

@rawtaz
Copy link

rawtaz commented Dec 13, 2023

The default option works well for most sites (I think)

I think we need to clarify something here - No one here is asking to change the current default behavior. Even with what we suggest in this feature request, Hugo would behave the same by default.

All we are asking for is simply a way to centrally (in the main config) change the default permalink format using a new setting. The setting would naturally have a default value that is the same as the current default permalink format. Hence, it's only when someone actively adds this new setting to the config (and with a non-default value), that the behavior would change.

I would hate, as a beginner, to find my URLs changed when porting a site to Hugo

This will not happen out of the blue unless you actively reconfigure Hugo, so there's no problem here.

without knowing they are set in config, and having to dig up through multiple files and hours to figure this out

No need for that.

At least with the default setting, I am aware it is using directory path.

Even if this feature request is implemented, it will default to the directory path you want, so no problem here either.


To clarify further:

  1. If the format is specified in the section (which can be already be done), use that.
  2. Otherwise, if the format is specified in the config (this feature request), use that.
  3. Otherwise, fall back to the current default for permalink format (which effectively would be the default of the setting in point # 2 above).

@bep bep added this to the v0.131.0 milestone Jul 30, 2024
@bep bep modified the milestones: v0.131.0, v0.133.0 Aug 9, 2024
@bep bep modified the milestones: v0.133.0, Unscheduled Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants