我正在使用 Middleman 和 Slim 模板。
我正在代理数据以自动创建多个页面。我需要使用变量设置 YAML 前端,但我不知道该怎么做!有人知道吗?
例如
在 config.rb
data.videos.expert_challenge_videos.each do |v|
proxy "/live/expertchallenge/#{v.slug}.html", "/live/expertchallenge/template.html", :locals => { :v => v }, :ignore => true
end
在 template.html.slim
---
title: Expert Challenge - #{v.name}
---
.live-single-video
== partial 'header'
.spacer
.grid-container
.grid-100.heading
== image_tag "label-expertchallenge.png", alt: ''
.grid-container
.grid-100.video-container
iframe src="http://area.autodesk.com/areaadmin/ooyala/show/ZobHQ4NzrsYP4CNnu2EijUGDRztihF7j/1000/562" width="1000" height="562" frameborder="0" webkitAllowFullScreen="webkitAllowFullScreen" mozallowfullscreen="mozallowfullscreen" allowFullScreen="allowFullScreen"
.grid-container
.grid-50.video-description
.name
| <b>Name:</b> #{v.name}
.date
| <b>Date:</b> #{v.date}
.topics
| <b>Topics:</b> #{v.topics}
.grid-50.video-share
| <div class="fb-like" data-send="false" data-layout="button_count" data-width="200" data-show-faces="false" data-href="#{endpoint}/live/expertchallenge/#{v.slug}.html"></div>
| <a href="https://twitter.com/share" class="twitter-share-button" data-url="#{endpoint}/live/expertchallenge/#{v.slug}.html" data-via="Autodesk_ME" data-text="#{v.name}">Tweet</a>
== partial 'footer'