2

我正在使用 hugo ( https://gohugo.io/ ) 并尝试在菜单中创建外部链接 (docsy 主题)。

我将 _index.md 更改为:

---
title: "Documentation"
linkTitle: "Documentation"
url: "https://www.myurl.com"
weight: 20
menu:
  main:
    weight: 20
---

然而,雨果报告:

Rebuild failed: URLs with protocol (http*) not supported

谁能建议如何直接在菜单上创建外部 URL 链接?

谢谢,格雷戈尔

4

2 回答 2

0

请记住,“url”是一个预定义的前端变量,用于定义从站点根目录到内容页面的完整路径。如果你想在前面添加一个外部链接,我建议给变量一个不同的名字,例如“external_url”。

于 2021-07-19T18:54:26.153 回答
0

我刚刚添加了这样的内容:

[[menu.main]]
    name = "GitHub"
    weight = 50
    url = "https://github.com/google/docsy/"

到 config.toml 文件。

我在这里找到了 docsy 主题的解决方案:https ://www.docsy.dev/docs/adding-content/navigation/

希望这会有所帮助,格雷戈尔

于 2020-12-09T18:13:30.267 回答