Blogdown 和社交分享按钮上的链接

Blogdown and links on social sharing buttons

我是 hugo 和 blogdown 的新手,正在使用 hugo-academic 主题创建一个学术网站。

一切正常。除了社交分享按钮。当我 运行 blogdown::build_site() 时,博客 post 上的社交分享按钮似乎没有完整的 url,因此会失败。 看。 例如https://nkaza.github.io/post/urban-morphology-landscape-metrics/

url 变量是“/post/...”而不是 "baseurl/post/..."。

另一方面,如果我在终端中 运行 hugo,我会得到相同配置文件共享按钮的正确 urls。但是,Rmarkdown posts 消失了。这似乎是一种奇怪的行为。

有人可以指出正确的方向来修复 urls 吗?

如果有兴趣,网站资源在https://github.com/nkaza/website 发布版本在 https://nkaza.github.io

奇怪!您的代码通过使用 blogdown::build_site()hugo

在我的机器上运行

这是生成的 html 的一部分,url 看起来不错:

<li>
  <a class="twitter"
     href="https://twitter.com/intent/tweet?text=Using%20Blogdown%20and%20Github&amp;url=https%3a%2f%2fnkaza.github.io%2fpost%2fusing-blogdown%2f"
     target="_blank" rel="noopener">
    <i class="fa fa-twitter"></i>
  </a>
</li>

您可能正在使用旧的 hugo,请尝试通过 blogdown::update_hugo()

更新它

还有..

If, on the other hand, I run hugo in the terminal, I get the right urls for the sharing buttons for the same config file. However, the Rmarkdown posts disappear. This seems like a strange behaviour.

这是因为它们是 drafts,要渲染草稿,请使用

hugo -D