我试图在Wyam帖子中包含带有html的文件,但我真的不明白如何使它工作。
我在config.wyam
首先将Include()
模块添加到RenderBlogPosts
Pipelines["RenderBlogPosts"].Add(Include());
BlogPosts
旁边
Pipelines["BlogPosts"].Add(Include());
然后我尝试通过添加另一个管道
Pipelines.Add("Content",
ReadFiles("**/*.md"),
Include(),
WriteFiles()
);
我想用它在Markdown文件test-include.html
中包含一个HTML文件test.md
。这些文件都在同一目录中。
这里我使用了https://wyam.io/modules/include
中的语法---
Title: Test include
Published: 4/6/2019
Tags: [General]
---
# This page should contain the included content
^"test-include.html"
<h2>This should show in the post</h2>
<h1 id="this-page-should-contain-the-included-content">This page should contain the included content</h1>
<h2>This should show in the post</h2>
<h1 id="this-page-should-contain-the-included-content">This page should contain the included content</h1>
<p>^"test-include.html"</p>
我在这里做什么错了?
答案 0 :(得分:1)
您正在使用哪个版本的Wyam?听起来您也在使用博客食谱,对吗?如果使用的是最新版本并使用配方,则默认情况下会启用shortcodes,因此您无需添加任何其他模块或管道。这是包含文件的最简单方法(旧的Include
模块可以继续工作,但是您需要注意的是需要手动添加它)。
尝试一下:
---
Title: Test include
Published: 4/6/2019
Tags: [General]
---
# This page should contain the included content
<?# Include "test-include.html" /?>
如果所包含的文件包含Markdown语法,您甚至可以在之前将其包含在内,Markdown引擎的语法稍有变化:
---
Title: Test include
Published: 4/6/2019
Tags: [General]
---
# This page should contain the included content
<?! Include "test-include.md" /?>