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

Change URL path #1011

Open
jamesdeluk opened this issue Nov 3, 2024 · 3 comments
Open

Change URL path #1011

jamesdeluk opened this issue Nov 3, 2024 · 3 comments

Comments

@jamesdeluk
Copy link

jamesdeluk commented Nov 3, 2024

Is it possible to change the URL?

For example, currently it is:

www.mywebsite.com/posts/category/sub-category/my-post

Is it possible to drop the categories and make it simply:

www.mywebsite.com/posts/my-post

?

Failing that, can I set up redirects? It would be a lot more complicated but it's better than nothing.

Thanks!

@jackwu925
Copy link

I have the same issue with you dude. The URL is a bit long and complex. :-(

@jamesdeluk
Copy link
Author

jamesdeluk commented Nov 4, 2024

Oh, that was simpler than I thought. It's a Hugo thing, not a theme thing.

To config.yaml, add:

permalinks:
  page:
    /: ':section/:slugorfilename'

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

I suggest adding it to the template.

Interestingly, the long URL (with cats/sub-cats) still seems to work too.

@jackwu925
Copy link

thx that makes more sense. I will try that.

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

No branches or pull requests

2 participants