samhuri.net/lib/pressa/views/post_list_item_view.rb
Sami Samhuri e43bb0a71b Add tag tooling: bake tags report and unlinked /tags/ pages
Adds Posts::TagIndex (counts, per-tag posts, per-tag/year breakdown)
and Posts::TagReport, wired into a new `bake tags` task that prints a
frequency table plus a tag-by-year sparkline straight to the terminal.

Also generates /tags/ and /tags/<tag>/ HTML pages via the existing
Posts plugin, listing tags with post counts and per-tag post listings.
Not linked from nav yet -- reachable by URL only until tags are
curated enough to surface properly.

Extracted PostListItemView out of YearPostsView so the post-link
rendering (incl. link posts) is shared with the new tag pages instead
of duplicated.
2026-06-21 20:43:30 -07:00

32 lines
655 B
Ruby

require "phlex"
module Pressa
module Views
class PostListItemView < Phlex::HTML
def initialize(post:)
@post = post
end
def view_template
if @post.link_post?
li do
a(href: @post.link) { "#{@post.title}" }
time { short_date(@post.date) }
a(class: "permalink", href: @post.path) { "" }
end
else
li do
a(href: @post.path) { @post.title }
time { short_date(@post.date) }
end
end
end
private
def short_date(date)
date.strftime("%-d %b %Y")
end
end
end
end