I recently migrated from a dynamic CMS => Hugo [and love it], but appears I’ve screwed something up in trying to get sneaky… I think I know how to fix it, but not the ideal solution.
My old content tagging used /tags/ vs. /Tags/ in the URL. I wanted to support both and have one redirect to Hugo’s use of /tags/. In addition, I wanted to recategorize a lot of my content and consolidate some tags, so I created a ./content/tags folder and for each tag, I created a subfolder and _index.md file. Within that index file, I added aliases… like so:
This migrated me from the old tag “SPFx” => “SharePoint Framework” and added support for the sentence case URLs with Tags.
It appears this has screwed up the rollup generation as my rollups for those categories are coming up blank. There are multiple pages created for paging, but all of them have no content in them, just the HTML from the theme of the site.
I can confirm this is what caused it because when I remove the ./content/tags/SharePoint Framework folder and rebuild, it works as desired, just without my aliases.
My question after trying to figure this out for the last day is how do you control the front matter for tag rollup pages, such as overriding the title, description, seo & creating aliases without breaking the content?
What’s odd is the behavior is different if I run the local hugo server vs when I do a full build. hugo server puts content on the tag rollup pages, but hugo build leaves them empty as you can see from this live page: https://www.andrewconnell.com/tags/SharePoint-Framework
I don’t understand the link to taxonomies… I read the docs & I’ve done what it shows, by adding frontmatter to an index page, but when I do that, there’s no content added to the page (as you can see from my previous link).
I’ve further noticed that this is affecting only those tags with spaces in them. From the link above, if you try other tags without spaces, there’s no issue, but tags with spaces are causing an issue.
The part that’s really confusing me is why hugo serve and hugo are generating different results, serving content from memory vs. disk. Running 0.57.2 but had the same issue with 0.57.0.
Yes, the content is in a private repo (not on GitHub, but Azure DevOps… that shouldn’t matter though). If you’re asking so you can see what I’m doing, what exactly are you looking for and I can share a subset of it. however, the contents of the ./content/tags/SharePoint Framework/_index.md file that’s used to set the front matter on the tag that I linked to above is in my OP above.
It’s difficult to say what’s wrong with your code. Maybe it’s the whitespace in the aliases urls, maybe it’s something else in your config somewhere. You have mentioned that you have your repo private somewhere; if you are unable to share that, please make a smaller repo with dummy content reproducing the problem that we can have a look at, as per Requesting Help . It’s easier for us to help when there’s a repo we can clone instead of creating one ourselves hoping to match yours.
You’re right… this was a poor way to ask for help without providing much context. I’ve copied the codebase into a public repo here (sans media so there will be a bunch of broken images): https://github.com/andrewconnell/hugo-issue-repro
To reproduce what i’m seeing:
clone the repo
run hugo server and click the first post’s tag no the home page “SharePoint Framework”… notice content shows up on the page
CTRL+C to stop local webserver
run hugo
open the following in the browser: ./public/Tags/SharePoint Framework/index.html
observe (while rendering is all messed up), no content showing in the body of the page… it should show a rollup of content for my tagged content
The alias, by default, generates a small file that redirects to the canonical URL for the content. In this case, it redirects to /tags/SharePoint-Framework/.
I think you already have, so maybe there is a different question? As in, I don’t think front matter is breaking content, in this scenario.
Tags and tags wouldn’t fly in Windows, me thinks. Could that be an issue with Azure (I don’t know about it, aside from who makes it)?
To calrify: what is a “rollup page”? We don’t have anyone using that word in the forums, it’s new to me. A tag page?
Correct… I have done this, but I can’t tell if this is causing the issue or not. I’m trying to provide alternate links via aliases due to my different casing & renamed tags from my old platform.
Azure = Microsoft’s public cloud, but the storage used for the site is case sensitive (ie: not Windows where casing doesn’t matter).
Sorry on the terminology… when I said “rollup”, i’m referring to the page that’s summarizing content in the taxonomy. So, the site homepage is a summary, or rollup, of excerpts of my most recent 15 posts.
That’s sort of my problem, I can’t tell where that’s coming from. I hired someone to build the theme from my existing (now previous) dynamic CMS site. Looking at the theme, I can’t figure out what’s generating these pages for tags.
Agreed… it’s only the first page (but that first page is also losing the pagination at the bottom of the page, so users can’t get to page 2. I have to think this has something to do with the space in the tag, because other tags without spaces don’t have this issue… ie: https://www.andrewconnell.com/tags/azure/
I’ve looked at the config.yml & so far after a lot of testing, I haven’t found anything that would address the issue, or anything in my templates that’s causing it. Your advice is why I came here… I agree… but I’m at a loss…
Not sure if it helps, but above I linked to a public repo of my site so you can see the config & theme for yourself… appreciate the reply, but still unsure what else to look at from what I’ve already done…
Sorry homey, I’ve got nothing else. Nothing is popping out to me from the theme, but others might see it. And I certainly don’t know why it works locally… have you perhaps fixed it and not redeployed?
Nope… that’s not it… site is automatically rebuilt & redeployed every hour 8a-6p M-F. I checked the source and seeing the same thing…
If I delete the ./content/tags/SharePoint Framework folder, it starts working, but I lose the alias I setup for /tags/SPFx & /Tags/SPFx (the tag I used to use) and that solution is equally bad.
I suspect that you are having collisions from your tags defined in content/tags/tag/_index.md files.
Assuming defaults and minimal configs:
Having content/posts/one.md with
tags:
- foo bar
will generate a tags listing page at yoursite.com/tags/foo-bar/ by default.
Having content/tags/Foo Bar/_index.md will also generate a page at yoursite.com/tags/foo-bar/.
These two are not the same “Page” however. You can test this out by adding the following lines to your list layout:
{{.Page}}
<br>
{{.Pages}}
Run hugo server. Navigate to and observe /tags/foo-bar/ locally, while saving a file a few times to trigger a few Hugo builds, and you probably see different values printed:
Page(/tags/foo bar/_index.md)
Pages(0)
and
Page(/tags/foo-bar)
Pages(2)
My suggestion would be to try to keep the content/tags/tag/_index.md file names the way Hugo expects them to look (ie foo-bar instead of Foo Bar) and see if you still get collisions.