xianmin / hugo-theme-jane

A readable & concise theme for Hugo, color schemes to choose, easy to personalize. Working well since 2018.
https://xianmin.github.io/hugo-theme-jane/
MIT License
923 stars 286 forks source link

布署到阿里云OSS上所有的链接都跳回了主页 #185

Closed pandahereboy closed 5 years ago

pandahereboy commented 5 years ago

你好,我使用jane 做为theme并布署到阿里云上时,遇到一个问题与 hexo 的问题类似(可参见如下链接:https://yq.aliyun.com/articles/653541)

因为OSS / AWS S3 要求是全路径的,而jane我找不到有哪个配置是可以实现类似/post/test/index.html 而不是/post/test/.

你可以告诉我怎么做吗?

shaform commented 5 years ago

Try ugly URLs https://gohugo.io/content-management/urls/#ugly-urls

pandahereboy commented 5 years ago

Try ugly URLs https://gohugo.io/content-management/urls/#ugly-urls

谢谢,这个参数我试过了。仅可以解决 /post下生成的文章链接问题,甚至我们可以在 hugo new post/xxx.md 里直接指定: url: xxx/xxx/xxx.html 然后再生成静态页面。但仍然是只解决post列表的文章链接问题,对于 归档 , 分类标签等需要聚合的操作还是没办法解决。

因为对于像AWS S3 , Aliyun OSS这种对象存储静态网页化,都是要求绝对路径的访问(对于public bucket),当然,还有折中的方法。例如在请求到达OSS 或 S3触发一个函数计算或lambda function做重定向。但这样子好麻烦,有更简单的方法就更好了。

pandahereboy commented 5 years ago

或者单页应用的theme...

shaform commented 5 years ago

I've did some tests, setting uglyurls = true does move /tags/ to /tags.html and /tags/footnote/ to /tags/footnote.html.

One thing to notice is that the URLs on the menu is hardcoded in config.toml [[menu]] so if you want to change the URLs in menu, you'll also need to change it.

pandahereboy commented 5 years ago

it worked, thanks.