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

Allow :sections[1:] etc. in permalinks config #8363

Closed
bep opened this issue Mar 25, 2021 · 1 comment · Fixed by #8371
Closed

Allow :sections[1:] etc. in permalinks config #8363

bep opened this issue Mar 25, 2021 · 1 comment · Fixed by #8371
Assignees
Milestone

Comments

@bep
Copy link
Member

bep commented Mar 25, 2021

I'm in the process of fixing the rather odd section setup in the Hugo Docs site. By putting the documentation below a documentation page we will, by default, get URLs on the form:

https://gohugo.io/documentation/content-management/urls/#permalinks

Vs the old:

https://gohugo.io/content-management/urls/#permalinks

Which in itself would no be too bad, but it would break a lots of links. We could create redirects for them, but I'd rather avoid that. But I do think it would be useful for others to have a way to only include parts of the sections in your URL, so I suggest we expand the permalinks syntax a little to support the variants below:

:sections[1:] // all but the first
:sections[0] // the first
:sections[:2] // first two
:sections[last]

And variations of the above. We need to do some bounds checking and return an empty string when out of bounds.

@bep bep self-assigned this Mar 25, 2021
@bep bep added this to the v0.83 milestone Mar 25, 2021
bep added a commit to bep/hugo that referenced this issue Mar 28, 2021
@bep bep closed this as completed in #8371 Mar 30, 2021
bep added a commit that referenced this issue Mar 30, 2021
bep added a commit that referenced this issue Apr 25, 2021
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant