How to add a Liquid tag into YAML front matter in Jekyll? -


i'm using plugin count page views posts , pages based on google analytics. display page view count i'm using liquid tag {% pageview %}. there way add data yaml front matter, can accessed in list of popular posts on other pages {{ page.views }}?

here code liquid tag in plugin:

class pageviewtag < liquid::tag    def initialize(name, marker, token)     @params = hash[*marker.split(/(?:: *)|(?:, *)/)]     super   end    def render(context)     site = context.environments.first['site']     if !site['page-view']       return ''     end      post = context.environments.first['post']     if post == nil       post = context.environments.first['page']       if post == nil         return ''       end     end      pv = post['_pv']     if pv == nil       return ''     end      html = pv.to_s.reverse.gsub(/...(?=.)/,"\\&\u2009").reverse     return html   end #render end # pageviewtag 

how can instead of registering liquid tag merge data data of post (document in collection)? , use via {{ page.views }}.

you can use generator plugin add data['views'] posts or pages.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -