-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Option to change taxonomies URL #1208
Comments
+1 |
1 similar comment
+1 |
Great idea; +1! |
+1 |
+1 would be useful for us using non-english languages, I've managed to translate everything except the "Tags" :( |
This would also allow us to create taxonomy urls that are inside the same folder as a section:
This is the same URL scheme that Jekyll is using. It is also discussed in create section taxonomies. |
+1 |
Is this still not possible? I want to create my main website and blog in the same Hugo site, with the contents of the blog all inside |
When you define categories and tags in your config file, you have to declare the single and plural form of it as per the documentation:
Correct me if I'm wrong. I believe the taxonomies urls are formed by taking the plural, so it is possible to change the config into something like this:
and in the front matter of your page, instead of using "tags", you use "hello" to define the tags:
The path to the tag listing will become http://yoursite/hello/tag1 You can probably put any string in place of "tags" or "categories," but it cannot be empty. |
@peterychuang I could hack my way around this with your suggestion 😄 I wondered if using a string such as In the templates I had to change things like So, to sum up: In
In the front matter of any markdown post:
I know the front matter looks a little weird, but no way around that :( |
@dekked Glad that it works out for you. I figured out a not-so-pretty way to remove "categories" from the url. The downside of doing so are 1) pagination doesn't work, and 2) the original category pages at Not an ideal solution, but works for me, for now. |
+1 Really looking forward to this as well. |
@dekked Your solution is almost what I wanted (blog/categories, blog/tags). But I am unable to figure it out how to display all tags/categories at site level. Currently I am doing it as follows: {{ range $name, $taxonomy := .Site.Taxonomies.tags }} How to pass "blog/tags" to .Site.Taxonomies? |
One way I found to do it is: {{ range $taxonomyname, $taxonomy := .Site.Taxonomies }} Not sure whether it is optimal way or not, but working. |
@sivaprasadreddy sorry for the late response. You can do this:
|
Stumbled into this problem as well. When you have your posts in |
For a given taxonomy list, I'm pretty sure you can set the |
why not general purpose url rewrite configuration? something like this:
|
btw. neither looks like the switch-statement in https://github.com/spf13/hugo/blob/d6000a208c7687ca3a3efd6961ac941ce325e199/hugolib/page.go#L1413 is the source of this problem. If we remove it, we could define urls to
or am I wrong? |
Hack to rename categories to blog/categories so that URLs will continue to map properly. See gohugoio/hugo#1208 (comment)
Hack to rename categories to blog/categories so that URLs will continue to map properly. See gohugoio/hugo#1208 (comment)
+1 in
|
Return the correct virtual Section for Taxonomy and TaxonomyTerm. Restrict permalink expansion to only Pages and Taxonomies, but then actually use expanded permalinks even for non-Pages. Fixes gohugoio#1208.
Return the correct virtual Section for Taxonomy and TaxonomyTerm. Restrict permalink expansion to only Pages and Taxonomies, but then actually use expanded permalinks even for non-Pages. Fixes gohugoio#1208.
Return the correct virtual Section for Taxonomy and TaxonomyTerm. Restrict permalink expansion to only Pages and Taxonomies, but then actually use expanded permalinks even for non-Pages. Fixes #1208.
Did this work? |
Did we get a resolution on this? I'm a good enough golang programmer to trust myself to not introduce bugs. |
9abd3043a Add docs for shimming JS libraries 6a1c8dcd7 Update sitemap-template.md (#1245) 37c397332 Update frontends.md a0f86f6df Update configuration.md bb00cb2c1 Update page-bundles.md 773212de6 Restructure and simplify fcba7dddf Some minor clarifications of weight sorting 759b967fc Update configuration-markup.md 56708f0b7 module import path remove slash at end 59f4f4acd Doc: Fix typo in hugo command faacf2e97 Clarify pagination documentation (#1208) d8eb60887 netlify: Bump to 0.75.1 8cedf6231 Merge branch 'temp751' 188e2bf56 releaser: Add release notes to /docs for release of 0.75.1 c96d4b7a3 Update index.md 1a9d192f7 Update index.md 32731b916 Update index.md a5bfa0c9a Restore the ... home page b6850bf96 Release 0.75.0 d6e5e624f releaser: Add release notes to /docs for release of 0.75.0 8cd6b4f47 typo: already -> already 2cb2b22bb Merge commit '534ae9c57a902aea9ed6e62390dec11fa74b7122' e3525de23 docs: Regen docs helper fd746dd83 docs: Regenerate CLI docs e20127980 Add "hugo mod npm pack" 8e82c7ce1 markup/highlight: Add support to linkable line anchors on Chroma 21e94911b markup/asciidocext: Fix AsciiDoc TOC with code 50b8dace5 modules: Add noVendor to module config d05b541fe modules: Make ignoreVendor a glob pattern c946082e7 docs: Update replaceRE func 149054341 docs: Update replace func d917567df docs: Update merge function f1e093c92 docs: Regen CLI docs c7bac967d docs: Regen docs helper 7a38f7a45 Merge commit '7d7771b673e5949f554515a2c236b23192c765c8' 1a5a7263a markup/asciidoc: Add support for .TableOfContents git-subtree-dir: docs git-subtree-split: 9abd3043a9214b390e8cc148f4588bf630620851
Its work, just change the custom permalink in
In the front matter of any markdown post:
|
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. |
As discussed here on the forum, it would be nice to have the ability to change the default URLs generated by Hugo for taxonomies.
Right now, we only have plural form, like
http://website.tld/tags/cat
. An option could give insteadhttp://website.tld/tag/cat
for the same URL.Maybe a good solution would be to let user decide what he wants in the URL. That way, we could choose the singular instead of plural, but also an other word completely (
http://website.tld/pet/cat
), or nothing at all (http://website.tld/cat
).EDIT : as described here, there's an easy way to have singular instead of plural. But we could have an option to change entirely the URL.
The text was updated successfully, but these errors were encountered: