I’ve always loved aliases
and used them quite extensively on Hugo. I’ve been running v0.110.0
for a while now but it appears certain aliases that used to work no longer do.
I’m not sure when this behavior started happening and can’t find any consistency between my aliases that work and the ones that don’t.
Examples not working:
These result in a 404 Error
File: content/years/2023.md
Aliases: aliases: ["/support.html"]
File: content/sunrise/2021/september/26.md
Aliases: aliases: ["/1000.html"]
Examples working:
File: content/days/january/1.md
Aliases: aliases: ["/hatsuhinode.html"]
File: content/location/sugarloaf-mountain/_index.md
Aliases: aliases: ["/sugarloaf.html"]
Would love to hear any suggestions of something I could investigate, but I haven’t been able to find any inconsistencies between the ones that are working and the ones that aren’t.
Unable to reproduce.
front matter of posts/post-1.md
aliases = ['foo-1','/foo-2','foo-3/','/foo-4/','foo-5.html','/foo-6.html']
command
rm -rf public/ && hugo && tree public
result
public/
├── foo-2/
│ └── index.html
├── foo-4/
│ └── index.html
├── posts/
│ ├── foo-1/
│ │ └── index.html
│ ├── foo-3/
│ │ └── index.html
│ ├── post-1/
│ │ └── index.html
│ ├── foo-5.html
│ └── index.html
├── favicon.ico
├── foo-6.html
└── index.html
I tested this on two different pages.
You’ll see the zoo
example output all the expected redirects.
However, the foo
example did not, and this is from the 2023.md
where other redirects were not working.
Here is the full frontmatter for the content/years/2023.md
file
---
title: Year of the Sunrise V
date: 2023-01-01
publishdate: 2020-01-01
year: 2023
yots: V
seotitle: Considering a fifth year of consecutive sunrises.
ogtitle: We need to start talking about what's ahead...
description: The truth is, I don't want to be done, but this project is still a long ways from being sustainable.
ogdescription: The truth is, I don't want to be done, but this project is still a long ways from being sustainable.
ogimage: https://bugsys.imgix.net/bugsy/sunrise/portraits/bugsy-12-09-2020.jpg?w=1200&h=630&fit=crop&crop=focalpoint&fp-debugX=true&fp-x=.5&fp-y=.5&q=90&fp-z=1.1&con=10
outputs: ['html']
aliases: ['foo-1','/foo-2','foo-3/','/foo-4/','foo-5.html','/foo-6.html']
layout: content-year
---
So far I’m stumped.
This is a long shot, but what do you see with:
hugo server --printPathWarnings
I don’t think you posted the “bar” example.
My apologies, I meant foo
instead of bar.
(when I used bar, the tree view was truncated in my terminal since the file listing was so long, so I used foo
and zoo
, as I couldn’t see anything in the directory before D...
)
Hoping to do some more testing this weekend.