How can I access un-rendered (markdown) content in Jekyll with liquid tags?

前端 未结 3 414
情深已故
情深已故 2020-12-17 17:50

From reading the documentation Jekyll\'s template data one might think that the way to access un-rendered content would be page.content; but as far as I can tel

3条回答
  •  囚心锁ツ
    2020-12-17 18:44

    This should work.

    # frozen_string_literal: true
    
    module RawContent
      class Generator < Jekyll::Generator
        def generate(site)
          site.posts.docs.each do |post|
            post.data['raw_content'] = post.content
          end
        end
      end
    end
    

提交回复
热议问题