假设我有一个较旧的帖子,contents/post/2019-04-29-old-post.Rmd
并且想从新的rmarkdown帖子链接到它。有什么方法可以在不使用实时网站的硬编码网址的情况下做到这一点的(这样,当我的网址更改时,我就不必更改所有这些交叉链接)?
现在,我这样做:
In the [previous post](https://my.si.te/2019/04/29/old-post.html) we covered...
有没有办法以某种方式(可能是Rmd文件名)识别旧帖子,并让Blogdown / Hugo生成正确的URL?
如果您正确设置了基本URL,config.toml
如下所示:
baseurl = "https://my.si.te/"
languageCode = "en-us"
title = "A Hugo website"
theme = "hugo-lithium"
googleAnalytics = ""
并且已经设置了[permalinks]
设置(也在中config.toml
):
[permalinks]
post = "/:year/:month/:day/:slug/"
然后,基本URL成为根文件夹,因此您可以像这样链接:
In the [previous post](/2019/04/29/old-post/) we covered...
通用形式是
In the [previous post](/:year/:month/:day/:slug/) we covered...
基于[permalinks]
选项。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句