在 Middleman 的 Haml 文件中使用 Yaml 属性

Using Yaml attributes within Haml files for Middleman

我创建了一个中间人应用程序,并试图在我的 Haml 文件中使用 Yaml 属性,但没有成功。这是我非常简单的代码:

\---
title: This is my title
\---

/ This is my paragraph
%p Hello world! This is = current_article.title

然而,以上仅生成此:

--- title: This is my title ---
Hello world! This is = current_article.title

我尝试了 this 问题的答案,但它不起作用。谁能告诉我我忽略或遗漏了什么。

在haml中你必须使用#{}来显示变量,试试:

\---
title: This is my title
\---

/ This is my paragraph
%p Hello world! This is #{current_article.title}