【问题标题】:hugo URLs with protocol (http) not supported不支持带有协议 (http) 的 hugo URL
【发布时间】:2023-04-10 17:52:01
【问题描述】:

我正在使用 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 链接?

谢谢你,格雷戈

【问题讨论】:

标签: hugo docsy


【解决方案1】:

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

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

到 config.toml 文件。

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

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

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2015-09-11
      • 2018-12-02
      • 2013-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多