How to setup redirects with Hugo and GitHub Pages

Hey all, we are trying to set up some redirects for our website. How can I do this using Hugo and GitHub pages (not Netlify)?

I was not able to figure this out. Thanks!

GitHub Pages doesn’t offer this as far as I know. But you can still do it via plain old HTML redirects. See:

2 Likes

希望可以提供类似 hexo-generator-alias (hexo 插件)的功能。

Hope to provide functionality similar to hexo-generator-alias (hexo plug-in).

在 _config.yml 文件直接配置:

Configured directly in the _config.yml file:

alias:
  api/index.html: api/classes/Hexo.html
  plugins/index.html: https://github.com/

因为很多时候我们选择静态博客,可能不具备服务器能力或者相关重定向权限。如果生成器可以实现 html 文件重定向是非常理想的结果。

Because many times we choose static blogs that may not have server capabilities or relevant redirection permissions. If the generator can realize html file redirection is a very desirable result.