Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在变量中创建自定义液体变量(即自定义液体对象)? 让我们考虑下面的代码: --- layout: post title: "Welcome to Jekyll!" test: name: google.com --- {{ post.test.name }} {% assign addr="https://www.google.com" %} # Heading This is a link to [the Google homepage!][ghome] This is another link that [may or maynot work][glink] [ghome]: https://google.com [glink]: {{ addr }}_Jekyll_Liquid_Yaml Front Matter - Fatal编程技术网

如何在变量中创建自定义液体变量(即自定义液体对象)? 让我们考虑下面的代码: --- layout: post title: "Welcome to Jekyll!" test: name: google.com --- {{ post.test.name }} {% assign addr="https://www.google.com" %} # Heading This is a link to [the Google homepage!][ghome] This is another link that [may or maynot work][glink] [ghome]: https://google.com [glink]: {{ addr }}

如何在变量中创建自定义液体变量(即自定义液体对象)? 让我们考虑下面的代码: --- layout: post title: "Welcome to Jekyll!" test: name: google.com --- {{ post.test.name }} {% assign addr="https://www.google.com" %} # Heading This is a link to [the Google homepage!][ghome] This is another link that [may or maynot work][glink] [ghome]: https://google.com [glink]: {{ addr }},jekyll,liquid,yaml-front-matter,Jekyll,Liquid,Yaml Front Matter,它正确地输出: 但是,当我尝试执行相同操作,但将addr更改为test.addr (然后将其转换为测试的数据成员,链接断开: 我如何使上述工作 如何将新属性添加到变量页面。test页面前面的内容中 在页面中,数据向一个方向流动 前沿=>内容 您可以执行以下操作: {% assign addr = page.test.name %} [link][glink] [glink]: {{ addr }} 但是您不能执行以下操作: {% assign page.test.addr = "http

它正确地输出:

但是,当我尝试执行相同操作,但将
addr
更改为
test.addr
(然后将其转换为
测试的数据成员,链接断开:

  • 我如何使上述工作
  • 如何将新属性添加到变量
    页面。test
    页面前面的内容中

  • 页面中
    ,数据向一个方向流动

    前沿
    =>
    内容

    您可以执行以下操作:

    {% assign addr = page.test.name %}
    
    [link][glink]
    [glink]: {{ addr }}
    
    但是您不能执行以下操作:

    {% assign page.test.addr = "https://www.google.com" %}
    
    [link][glink]
    [glink]: {{ page.test.addr }}
    

    页面中
    ,数据向一个方向流动

    前沿
    =>
    内容

    您可以执行以下操作:

    {% assign addr = page.test.name %}
    
    [link][glink]
    [glink]: {{ addr }}
    
    但是您不能执行以下操作:

    {% assign page.test.addr = "https://www.google.com" %}
    
    [link][glink]
    [glink]: {{ page.test.addr }}
    

    第二个示例的代码是什么?
    link
    container
    来自哪里?@DavidJacquel它们分别是自定义变量和对象我正在尝试创建..是否要将
    test.name
    替换为
    container.link
    ?@DavidJacquel很抱歉造成混淆,我已经澄清了我的问题。link是指包含链接的变量,container是对象
    test
    。您不能修改在配置或前台中装箱的对象。您的代码是用于什么第二个例子是
    link
    container
    来自哪里?@DavidJacquel它们分别是自定义变量和对象我正在尝试创建..是否要将
    test.name
    替换为
    container.link
    ?@DavidJacquel很抱歉造成混淆,我已经澄清了我的问题。link是指包含链接的变量,container是对象
    test
    。您不能修改在config或front matter中装箱的对象。