How can I forward/ alias to an other page?

I want to forward from one of my pages to another and I can’t find a solution for that.
I have these two sites:
content/post/ and content/

The Urls look like these: and

I was thinking an alias would be the solution, so I tried this in the frontmatter of my new post:

- /oldpost/

but it don’t works, where is the mistake?

If newpost has alias=/oldpost, then when you go to /oldpost you will end up at /newpost

You can add oldpost alias=/newpost and when you got to /newpost you will end up at old post.

If you want to forward /this to /that you can setup a http meta refresh tag.

<meta http-equiv="refresh" content="0;URL=''" />

You can define page meta tags in front matter and read them using .Params. perhaps

EDIT: Or perhaps if you have access to .htaccess or your nginx site enabled file, you can use redirect there, 301 or 302 depending on what you want.

Ok thank you for your help, but I’m still not able to do the alias.
Im using YAML in my Frontmatter and this is the Frontmatter of the newpost:

title: "Alias problem"
draft: false
url: "/newpost"
- /oldpost/

But nothing happens. Do I miss something very easy?
Do I need to enable something that this works?

Do you have an example project for the meta refresh tag?

Ok. I got the redirect via the http meta refresh tag now.
But still would like to know, what the issue with the alias is.

http meta refresh is basically what hugo does as well when you create an alias. When aliases are specified, Hugo creates a directory to match the alias entry. Inside the directory, Hugo creates an .html file specifying the canonical URL for the page and the new redirect target.

In your front matter example, if you go to /oldpost, you should end up at /newpost which seems correct.

Does the alias in yaml need to be quoted as well?

Ah that makes sense. I tried quotes, but it makes no difference.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.