我有一個哲基爾頁面,在這裏我有兩個文件夾:products
_products/product_name
使用頁面屬性包括聲明傑奇
,我有一個產品頁面MD文件含有本:
---
title: product_title
subtitle: subtilte
layout: product
description: long description
product_icon: product_image_path
---
而這個簡單的佈局:
---
layout: default
---
<!-- Main -->
<div id="main">
<div id="content" class="container">
<header id="product_header">
<div class="half_left center">
<img id="product_icon" src="/assets/{{ page.product_icon }}" alt="">
<h2 id="product_title">{{ page.title }}</h2>
<h3 id="product_subtitle">{{page.subtitle}}</h3>
</div>
<div class="half_right center">
{% markdown _products/page.title/short.md %}
</div>
<div class="clear"></div>
</header>
{{content}}
</div>
</div>
然而在:{% markdown _products/page.title/short.md %}
我似乎無法捕捉頁面標題,我該怎麼辦呢?
我的降價標籤:
# From: http://wolfslittlestore.be/2013/10/rendering-markdown-in-jekyll/
=begin
Jekyll tag to include Markdown text from _includes directory preprocessing with Liquid.
Usage:
{% markdown <filename> %}
Dependency:
- kramdown
=end
module Jekyll
class MarkdownTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
@text = text.strip
end
require "kramdown"
def render(context)
tmpl = File.read File.join Dir.pwd, "", @text
site = context.registers[:site]
tmpl = (Liquid::Template.parse tmpl).render site.site_payload
html = Kramdown::Document.new(tmpl).to_html
end
end
end
Liquid::Template.register_tag('markdown', Jekyll::MarkdownTag)
誰能告訴我怎樣捕捉到{% markdown _products/page.title/short.md %}
我得到這個錯誤的page.title:Liquid Exception: No such file or directory @ rb_sysopen - /home/tools/git/pagename.github.io/_products/page.title/short in _layouts/product.html