如何在FoundationZurb中显示表达式



我正在使用Yeti Launch,我想使用expressions在每个页面上显示页面信息。

例如,我想显示页面title和该页面特定的其他一些内容。

所以主页会是{title: "homepage"},但我不知道如何让基础项目打印/显示这个。

以下是我的主页文件

{{!-- This is the base layout for your project, and will be used on every page. --}}
<!doctype html>
<html class="no-js" lang="en">
<head>
    <meta charset="utf-8" />
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{title}}</title>
    <link rel="stylesheet" href="{{root}}assets/css/app.css">
</head>
<script>
  var context = {title:"Homepage | Hey this is working"};
</script>
<body>
    <div id="siteContainer" class="cover">
        <div class="row">
            <header>
                <h1>Example</h1>
            </header>
        </div>
        <div id="navigation">
            <!-- eo // navigation -->
            <section id="contentWrapper">
                {{!-- Pages you create in the src/pages/ folder are inserted here when the flattened page is created. --}} {{> body}}
            </section>
            <!-- eo // section -->
        </div>
        <!-- eo // siteContainer -->
        <script src="{{root}}assets/js/app.js"></script>
</body>
</html>

基金会如何设置项目文件夹

src
   assets - /img/ - /js/ - /scss/
   data
   layouts
   pages
   partials
   styleguide

我的数据应该存储在哪里?以及如何显示或调用将数据拉到特定页面?

谢谢!

找到了答案。

我必须在page模板的顶部定义我的变量。

我做错了。我将变量添加到partial文件中,而不是页面模板中。

参考:

http://foundation.zurb.com/sites/docs/panini.html#custom-数据

http://jekyllrb.com/docs/frontmatter/

最新更新