在Hugo Static网站期间,短代码内容不会呈现在页面上



我对Hugo很陌生,并试图通过文档和其他东西来理解它。我正在创建一个简单的shortcode,我想将其包含在我的页面中,但由于某种原因,我的页面根本没有呈现快捷代码。

以下是我在layoutsshortcodesplain.html:中的短代码

{{ .Page.File.Ext }}
{{ . }}
{{ .Get "title" }}
{{ .Get "linkTitle" }}
<div>
{{ .Inner }}
</div>

以下是我想添加到HTML页面的内容:contenten_index.html:

+++
title = "Home-Test"
linkTitle = "Home-Test"
+++
{{< plain >}}
<h1>HELLO FROM BLOCKS SHORTCODES</h1>
{{< /plain >}}

以下是我基于layouts_defaultbaseof.html:的index.html

<!doctype html>
<html lang="{{ .Site.Language.Lang }}" class="no-js">
<head>
{{ partial "head.html" . }}
</head> 
<body>
{{ partial "loader.html" . }}
<header>
{{ partial "navbar.html" . }}
</header>
<main>
{{ block "plain" . }}{{ end }}
</main>
<footer>
{{ partial "footer.html" . }}
</footer>
{{ partialCached "scripts.html" . }}
</body>
</html>

我希望<h1>HELLO FROM BLOCKS SHORTCODES</h1>提供的内容应该显示在Hugo呈现的HTML页面上,但不显示。有人能纠正我在这里做错了什么吗?

这:

{{ block "plain" . }}{{ end }}

应为:

{{ .Content }}

相关内容

最新更新