werc-1.5.0-tweaks

Tweaks for the werc website builder created by the mad architect Uriel
Log | Files | Refs | README

jsonfeed.tpl (920B)


      1 {
      2 "version":       "https://jsonfeed.org/version/1",
      3 "title":         "%($siteTitle%)",
      4 "home_page_url": "%($"base_url%)",
      5 "feed_url":      "%($"base_url^$"req_path%)",
      6 "items": [
      7 %{
      8 fn statpost {
      9     f = $1
     10     post_uri=$base_url^`{cleanname `{echo $f | sed -e 's!^'$sitedir'!!'}}^'/'
     11     title=`{read $f/index.md}
     12     #ifs=() { summary=`{cat $f/index.md | crop_text 1024 ... | $formatter } }
     13     ifs=() { summary=`{cat $f/index.md | strip_title_from_md_file | ifs=$difs {$formatter| sed 's/"/\\"/g' | tr -d '\012' } } }
     14 }
     15 %}
     16 % #for(f in `{get_post_list $blagh_root$blagh_dirs}) {
     17 %
     18 % postlist=`{get_post_list $blagh_root$blagh_dirs}
     19 % postcount=0
     20 % for(f in $postlist) {
     21 %    statpost $f
     22         {
     23   "id": "%($post_uri%)",
     24   "url": "%($post_uri%)",
     25   "title": "%($title%)",
     26   "content_html": "%($summary%)"
     27   }
     28 % postcount = `{echo $postcount  1+p | dc}
     29 % if (! ~ $#postlist $postcount) { echo , }  
     30 % }
     31 ]
     32 }
     33 
     34 % exit 
     35