logo
down
shadow

How to access multiple nested variables in Jekyll YAML config


How to access multiple nested variables in Jekyll YAML config

Content Index :

How to access multiple nested variables in Jekyll YAML config
Tag : development , By : Rob
Date : November 24 2020, 09:00 AM

wish of those help In your _config.yml, you've defined site.github as a list, and you're trying to access it as an associative array, hence the problem.
If you want to access it as an associative array, you'll need to redefine your variable as such:
github:
  repo: 'https://github.com/foo/bar.github.io'

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

YAML front matter for Jekyll and nested lists


Tag : development , By : jbcrail
Date : March 29 2020, 07:55 AM
wish of those help I have a set of nested yaml lists with something like the following: , Update
This example I just wrote (called index.html)
---
title: the example
products:
 - top-level: Product One
   arbitrary: Value
   nested-products:
    - nested: Associated Product
      sub-arbitrary: Associated Value
    - nested: Another associate
      sub-arbitrary: with its associated value
 - top-level: Product Two
   arbitrary: Value
   nested-products:
    - nested: nested product Two
      sub-arbitrary: Two's nested's associate value
 - top-level: Product Three
   arbitrary: Value
 - top-level: Product Four
   arbitrary: SomeValue
---
<!-- index.html -->
<!DOCTYPE html>
<html lang="en">

<head>
  <title>{{ page.title }}</title>
</head>

<body>

<h4>products:</h4>
<ul>{% for product in page.products %}
  <li>{{ product.top-level }}: {{ product.arbitrary }}{% if product.nested-products %}
    <ul>
    {% for nestedproduct in product.nested-products %}  <li>{{ nestedproduct.nested }}: {{ nestedproduct.sub-arbitrary }}</li>
    {% endfor %}</ul>
  {% endif %}</li>{% endfor %}
</ul>

<p>Hope that answers it</p>

</body>
</html>
<!-- index.html -->
<!DOCTYPE html>
<html lang="en">

<head>
  <title>the example</title>
</head>

<body>

<h4>products:</h4>
<ul>
  <li>Product One: Value
    <ul>
      <li>Associated Product: Associated Value</li>
      <li>Another associate: with its associated value</li>
    </ul>
  </li>
  <li>Product Two: Value
    <ul>
      <li>nested product Two: Two's nested's associate value</li>
    </ul>
  </li>
  <li>Product Three: Value</li>
  <li>Product Four: SomeValue</li>
</ul>

<p>Hope that answers it</p>

</body>
</html>

Jekyll YAML file with nested elements


Tag : development , By : ChristianM
Date : March 29 2020, 07:55 AM
I wish did fix the issue. 1. your datas file is wrong you have overlapping entries for locales.en and locales.fr. Correct nesting can be :
locales:
games:
  en:
    title: "Games"
    detail: "To relax and take breaks during the day, we play football, table tennis and Xbox"
    icon: benefit1.png
  fr:
    title: "Jeux"
    detail: "To relax and take breaks during the day, we play football, table tennis and Xbox"
    icon: benefit1.png

drink:
  en:
    title: "Drink"
    detail: "The fridge is full of beer cans and Coca-Cola, Ice Tea and coffee. You can drink whatever makes you happy, all day!"
    icon: benefit2.png
  fr:
    title: "Boissons"
    detail: "The fridge is full of beer cans and Coca-Cola, Ice Tea and coffee. You can drink whatever makes you happy, all day!"
    icon: benefit2.png
benefit = Array
["en",{"title"=>"Drink", "detail"=>"The fridg...!", "icon"=>"benefit2.png"}]
{% for benefit in site.data.benefit.locales.games %}
<div class="s-column6">
  <div class="kiwup-benefit pb1 mb1">
    <img src="/image/benefit/{{ benefit[1].icon }}" alt="kiwuper">
    <div class="kiwup-benefit-info">
      <h3 class="h4-like text-dark">{{ benefit[1].title }}</h3>
      <p>{{ benefit[1].detail }}</p>
    </div>
  </div>
</div>
{% endfor %}

Tag : arrays , By : Monev
Date : March 29 2020, 07:55 AM
hop of those help? Why can't I loop through the main: image array for this project group in Jekyll? , It was an issue with your looping.
{% for project in navigation.project %}

  {% for image in project.main %}

    <!-- This loop needed to loop within its parent -->

  {% endfor %}

{% endfor %}
{% for item in site.data.navigation %}
<ul>
  <li>
    <p style="border: solid 1px red;">Project loop {{ forloop.index }}</p>
    {% for project in item.project %}
    <ul>
      <li>
        <p style="border: solid 1px green;">Sub Loop {{ forloop.index }}</p>
        <ul>
          <li style="border: solid 1px blue;">
            <p><strong>categ:-</strong> {{project.categ}}</p>
          </li>
          <li style="border: solid 1px blue;">
            <p><strong>name:-</strong> {{project.name}}</p>
          </li>
          <li style="border: solid 1px blue;">
            <p><strong>age:-</strong> {{project.age}}</p>
          </li>
          <li style="border: solid 1px blue;">
            <p><strong>feeling:-</strong> {{project.feeling}}</p>
          </li>
          <li style="border: solid 1px blue;">
            <p><strong>thumbnail:-</strong> {{project.thumb}}</p>
          </li>
          <li>
            <ol>
              {% for image in project.main %}
                <li style="border: solid 1px purple;">
                  <p>{{ image.image }}</p>              
                </li>          
              {% endfor %}
            </ol>            
          </li>
        </ul>
      </li>
    </ul>
    {% endfor %}
  </li>
</ul>
{% endfor %}
<div style="border: solid 4px purple; padding: 10px;">
  {% for item in site.data.navigation %}
    <div style="border: solid 3px red; padding: 10px; margin: 10px;">
      <pre>LOOP {{ forloop.index }}</pre>
      {% for project in item.project %}
        <div style="border: solid 2px green; padding: 10px; margin: 10px;">
          <pre>SUB LOOP {{ forloop.index }}</pre>
          {% for image in project.main %}
            <div style="border: solid 1px blue; padding: 10px; margin: 10px;">
              <pre>IMAGE {{ forloop.index }}</pre>
            </div>
          {% endfor %}
        </div>
      {% endfor %}
    </div>
  {% endfor %}
</div>
- project:
  -
    categ: navigation
    name: Letterman
    age: 54
    feeling: swell
    thumb: thumb-letterman.jpg
    main:
      - image: image_1.jpeg

- project:
  -
    categ: navigation
    name: Carlin
    age: 67
    feeling: nice
    thumb: thumb-carlin.jpg
    main:
      - image: image_1.jpeg
      - image: image_2.jpeg
      - image: image_3.jpeg

Access nested config variables in a rule


Tag : python , By : Sumedh
Date : March 29 2020, 07:55 AM
it fixes the issue One way to solve it is by using params and resolving the variable outside the shell block.
rule simgenome:
    input:
        "human.order6.mm",
    output:
        "{family}-refr.fa.gz"
    params:
        seed=lambda w: config[w.family]['seeds']['genome'],
        numseqs=lambda w: config[w.family]['numchr'],
        seqlen=lambda w: config[w.family]['chrlen']
    shell:
        "nuclmm simulate --out - --order 6 --numseqs {params.numseqs} --seqlen {params.seqlen} --seed {params.seed} {input} | gzip -c > {output}"

is possible to loop through yaml variables of jekyll page without knowing them?


Tag : development , By : baylisscg
Date : March 29 2020, 07:55 AM
hop of those help? When you loop on a Page (Page objects like index, about, ...) variables, you receive arrays like :
{% for var in page %}
  {{ var | inspect }} => ["layout", "default"]
{% for var in page %}
  key-name : {{ var[0] }} , value : {{ var[1] }}
{% endfor%}
{% for var in page %}
      key : {{ var }} , value : {{ page[var] }}
{% endfor%}
Related Posts Related QUESTIONS :
  • Issue with bwa mem process not running on all output files from previous process
  • Delete videos from playlist using YouTube API
  • How to restart the Hyperledger Composer Playground locally
  • How to configure email alerts in Zabbix Server?
  • Simulator is not working for smart home action with all configured session
  • How parse data using join on Objection.js
  • Assign an array to a property in a Chapel Class
  • Netlogo: How can I obtain the accumulate value in Netlogo?
  • How to populate datasource for listview using api response in react native?
  • Why does gmail API when using history.list method send message ids without the field what action has been preformed on t
  • How to run an append query in ms access vba as part of a transaction
  • Wrong dates shown in Jekyll-based blog
  • How to concatenate two document lists in a webMethods flow service?
  • How to properly set up a site map addition in a customization project
  • IBM Content Collector error calling external Web Service
  • Is (0*1*)* equal to (0 | 1)*?
  • How do I configure phpMyAdmin to start with a blank sql query from the SQL tab?
  • "Objects are not valid as a React child" Redux error when conditionally connecting a component?
  • Displacy results are not showing
  • Strapi / Graphql. What am i doing wrong?
  • How to add Search bar for django template?
  • lookup in presto using single column against a range in lookup table
  • How can you stop videos being stolen on website?
  • Can't code substitution happen in Hybrid Flow?
  • Removed widget remains on parent
  • setup saga middleware with redux-starter-kit's configureStore()
  • How to get cookies from response of scrapy splash
  • I need to do a firebase stream and not a Http Get
  • Unable to compile node-runtime
  • SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'where clause'
  • How to extract only the number from a variable
  • disable linter in DAML studio
  • RxJS: How to set exhaustMap concurrent?
  • How to remove perforce (p4) on Ubuntu
  • How do they know mean and std, the input value of transforms.Normalize
  • Why this type is not an Interface?
  • SugarCRM Rest API set_relationship between Contacts and Documents
  • Jira dashboard organization
  • Web worker importScripts fails to place script variables in global scope
  • Always errors - The "path" argument must be one of type string, Buffer, or URL. Received type undefined
  • How to create an observable of a stream of infinite items
  • Not efficiently to use multi-Core CPU for training Doc2vec with gensim
  • webGL gl_Position value saving outside shaders
  • Is it okay for a resolver to have side effects besides resolving the type?
  • Move 32bit register into a 8 bit register
  • Is there a way to update, not overwrite, worker_env for a Dask YarnCluster within a script?
  • Lotus Notes Deployment
  • How Do I Add Active Directory To APIM Using Terraform?
  • How to get the old parameter values in Blazor OnParameterSet?
  • How to debug "ERROR: Could not reach the worker node."?
  • How chain indefinite amount of flatMap operators in Reactor?
  • extract dates and times from string in Redshift
  • How do I make a column of 3 cards match in height in bootstrapVue?
  • how to replace missing values from another column in PySpark?
  • only read last line of text file (C++ Builder)
  • Snakemake --forceall --dag results in mysterius Error: <stdin>: syntax error in line 1 near 'File' from Graphvis
  • How Can I Remove Demo Products From APIM Created With Terraform?
  • How to avoid cloning a big integer in rust
  • Break a row of words into word groups in Hive
  • How can I add a path variable to existing files in an Installshield project converted from MSI
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com