私の Jekyll サイトには、特に RSS フィードで使用する場合に、抜粋に適していない要素がいくつかあります。これらは Liquid タグ (カスタム プラグインで実装) によって作成されるため、簡単に実行できるはずだと考えました。このようなものは賢明に思えます:
module Jekyll
class MyTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
end
def render(context)
if <in excerpt>
""
else
"this should not be in an excerpt"
end
end
end
end
Liquid::Template.register_tag('mytag', Jekyll::MyTag)
ただし、タグが抜粋用にレンダリングされているかどうかを確認する方法がわかりません。の contentx をダンプしても、有用なものは何も明らかcontext.environments
にcontext.scopes
なりcontext.registers
ませんでした。
これどうやってするの?