~hristoast/hristoast

4cd957da069b3ecf6227a216678404c17dfe661f — Hristos N. Triantafillou 1 year, 5 months ago 4540092
Use the built-in index stuff
2 files changed, 16 insertions(+), 29 deletions(-)

D scripts/index.py
M soupault.conf
D scripts/index.py => scripts/index.py +0 -28
@@ 1,28 0,0 @@
#!/usr/bin/env python3

# Forked from:
# https://github.com/dmbaturin/soupault.neocities.org/blob/314be103fb917edb06ca70f18b6f9370b120f5f5/scripts/index.py

import sys
import json

import pystache

template = """
<div class="entry">
<h3><a href="{{url}}">{{{title}}}</a></h3>
<p>Posted: {{date}}</p>
<p>{{{excerpt}}}</p>
<a href="{{url}}">Read more...</a>
</div>
"""

renderer = pystache.Renderer()

read = sys.stdin.readline()
index_entries = json.loads(read)

for entry in index_entries:
    # Don't try to list files that aren't blog posts.
    if entry["title"] is not None and entry["date"] is not None:
        print(renderer.render(template, entry))

M soupault.conf => soupault.conf +16 -1
@@ 31,11 31,26 @@
[index]
  index = true
  index_selector = "#blog-index"
  index_processor = "scripts/index.py"
  index_title_selector = "h1#title"
  index_date_selector = ["time#post-date", "time"]
  index_excerpt_selector = ["p#post-excerpt", "p"]
  newest_entries_first = true
  use_default_view = false

  exclude_path_regex = ["site/404.html", "site/contact.html", "site/gpg.html", "site/hello-world.html",
                        "site/init.el.html", "site/livejam.html", "site/now-playing.html",
                        "site/privacy.html", "site/projects.html", "site/radio.html", "site/xbps.html", ]

[index.views.blog]
  index_selector = "#blog-index"
  index_item_template = """
<div class="entry">
<h3><a href="{{url}}">{{{title}}}</a></h3>
<p>Posted: {{date}}</p>
<p>{{{excerpt}}}</p>
<a href="{{url}}">Read more...</a>
</div>
"""

[widgets.asciinema-player-css]
  widget = "insert-if"