【问题标题】:Jekyll - data files and structured YAMLJekyll - 数据文件和结构化 YAML
【发布时间】:2016-02-19 07:45:48
【问题描述】:

我正在为播客网站和 RSS 使用 Jekyll 模板,包括 iTunes 信息。现在,我的podcast.yml 文件是这样的:

name: "Fate Masters" 
gpluspage: "https://plus.google.com/communities/100913016060492249875" 
copyright: (CC BY-NC-SA) 2015 - Fate Masters 
language: pt-br 
podcast_links: 
    - format: MP3 
      link: http://feeds.feedburner.com/FateMastersRPG 
    - format: OGG 
      link: http://feeds.feedburner.com/FateMastersRPG-OGG 
 itunes-explicit: "NO" 
 itunes-keywords: "RPG, Fate, Fate Básico, Mestre, Narrador" 
 itunes-podcast_image: /images/FateMasters.jpg 
 itunes-author: "Fate Masters" 
 itunes-email: fabiocosta0305@gmail.com 
 itunes-categories: 
     - RPG 
     - Fate 
     - Fate Core 
     - Fate Básico

但是...查看所有那些itunes-* 标签...我喜欢将其作为itunes 结构化信息与 - 类别等配对...但我不能这样做,因为使用 @ 987654325@ 不会返回任何内容...

任何提示

【问题讨论】:

  • 'podcast.yml' 是 _data 文件还是集合?
  • 这是一个位于 _data 的文件

标签: yaml jekyll itunes github-pages podcast


【解决方案1】:

如果您的文件是数据文件,则必须将所有播客放在同一个文件中。

为了做到这一点,你必须重新格式化一点:

- name: "Fate Masters"
  gpluspage: "https://plus.google.com/communities/100913016060492249875"
  copyright: (CC BY-NC-SA) 2015 - Fate Masters
  language: pt-br
  podcast_links:
    - format: MP3
      link: http://feeds.feedburner.com/FateMastersRPG
    - format: OGG
      link: http://feeds.feedburner.com/FateMastersRPG-OGG
  itunes:
    explicit: "NO"
    keywords: "RPG, Fate, Fate Básico, Mestre, Narrador"
    podcast_image: /images/FateMasters.jpg
    author: "Fate Masters"
    email: fabiocosta0305@gmail.com
    categories:
     - RPG
     - Fate
     - Fate Core
     - Fate Básico

- name: "other"
  copyright: MIT

然后你可以像这样循环播放播客:

{% for p in site.data.podcast %}
<h2>{{ p.name }}</h2>
<p>{{ p.copyright }}</p>
{% endfor %}

【讨论】:

  • 感谢您的提示...但我想要将所有itunes-* 信息放入itunes 结构中
  • 您必须重新格式化您的 yml。我已经用 iTunes 键下的 iTunes 信息编辑了我的答案。
  • 谢谢...我会试试这个
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-10-09
  • 2011-03-10
  • 2015-09-25
相关资源
最近更新 更多