From 93be8ad37d93b6ef9e30f78f875b9411a254b738 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sun, 21 Jun 2026 19:43:52 -0700 Subject: [PATCH] Rename Archive to Posts --- lib/pressa/posts/plugin.rb | 2 +- lib/pressa/posts/writer.rb | 4 ++-- lib/pressa/views/archive_view.rb | 2 +- lib/pressa/views/layout.rb | 2 +- lib/pressa/views/year_posts_view.rb | 2 +- public/css/style.css | 14 +++++++------- test/posts/gemini_plugin_test.rb | 14 +++++++------- test/posts/writer_test.rb | 12 ++++++------ test/views/rendering_test.rb | 10 +++++----- 9 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lib/pressa/posts/plugin.rb b/lib/pressa/posts/plugin.rb index c0c3f14..27f816a 100644 --- a/lib/pressa/posts/plugin.rb +++ b/lib/pressa/posts/plugin.rb @@ -26,7 +26,7 @@ module Pressa writer = PostWriter.new(site:, posts_by_year: @posts_by_year) writer.write_posts(target_path:) writer.write_recent_posts(target_path:, limit: 10) - writer.write_archive(target_path:) + writer.write_posts_archive(target_path:) writer.write_year_indexes(target_path:) writer.write_month_rollups(target_path:) diff --git a/lib/pressa/posts/writer.rb b/lib/pressa/posts/writer.rb index 0d54aa1..c40aeee 100644 --- a/lib/pressa/posts/writer.rb +++ b/lib/pressa/posts/writer.rb @@ -36,11 +36,11 @@ module Pressa Utils::FileWriter.write(path: file_path, content: html) end - def write_archive(target_path:) + def write_posts_archive(target_path:) content_view = Views::ArchiveView.new(posts_by_year: @posts_by_year, site: @site) html = render_layout( - page_subtitle: "Archive", + page_subtitle: "Posts", canonical_url: @site.url_for("/posts/"), content: content_view, page_description: "Archive of all posts" diff --git a/lib/pressa/views/archive_view.rb b/lib/pressa/views/archive_view.rb index 1bde3b5..c515cc6 100644 --- a/lib/pressa/views/archive_view.rb +++ b/lib/pressa/views/archive_view.rb @@ -11,7 +11,7 @@ module Pressa def view_template div(class: "container") do - h1 { "Archive" } + h1 { "Posts" } end @posts_by_year.sorted_years.each do |year| diff --git a/lib/pressa/views/layout.rb b/lib/pressa/views/layout.rb index 4fcb5b8..bd0cda5 100644 --- a/lib/pressa/views/layout.rb +++ b/lib/pressa/views/layout.rb @@ -155,7 +155,7 @@ module Pressa nav(class: "local") do ul do li { a(href: site.url_for("/about")) { "About" } } - li { a(href: site.url_for("/posts")) { "Archive" } } + li { a(href: site.url_for("/posts")) { "Posts" } } li { a(href: site.url_for("/projects")) { "Projects" } } end end diff --git a/lib/pressa/views/year_posts_view.rb b/lib/pressa/views/year_posts_view.rb index 82b5743..9e03789 100644 --- a/lib/pressa/views/year_posts_view.rb +++ b/lib/pressa/views/year_posts_view.rb @@ -36,7 +36,7 @@ module Pressa end end - ul(class: "archive") do + ul(class: "posts") do month_posts.sorted_posts.each do |post| render_post_item(post) end diff --git a/public/css/style.css b/public/css/style.css index df42456..0e94829 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -346,7 +346,7 @@ footer a:visited { } /** - * Archive + * Posts */ h2.year a, @@ -356,7 +356,7 @@ h2.month a:visited { color: #000; } -ul.archive { +ul.posts { padding-left: 0; margin-left: 5%; margin-bottom: 2rem; @@ -364,20 +364,20 @@ ul.archive { } @media (min-width: 40rem) { - ul.archive { + ul.posts { margin-right: 5%; } } -ul.archive li { +ul.posts li { margin: 0.8rem 0; } -ul.archive li a { +ul.posts li a { text-decoration: none; } -ul.archive li time { +ul.posts li time { font-size: 80%; padding-left: 0.5rem; color: #6f6f6f; @@ -391,7 +391,7 @@ ul.archive li time { color: #ddd; } - ul.archive li time { + ul.posts li time { color: #919191; } } diff --git a/test/posts/gemini_plugin_test.rb b/test/posts/gemini_plugin_test.rb index 5bc9fab..c8cd3bf 100644 --- a/test/posts/gemini_plugin_test.rb +++ b/test/posts/gemini_plugin_test.rb @@ -82,7 +82,7 @@ class Pressa::Posts::GeminiPluginTest < Minitest::Test index_text = File.read(File.join(target_path, "index.gmi")) markdown_text = File.read(markdown_post) html_text = File.read(html_post) - archive_text = File.read(File.join(target_path, "posts/index.gmi")) + posts_text = File.read(File.join(target_path, "posts/index.gmi")) feed_text = File.read(File.join(target_path, "posts/feed.gmi")) assert_includes(index_text, "=> /about/") @@ -94,12 +94,12 @@ class Pressa::Posts::GeminiPluginTest < Minitest::Test assert_includes(markdown_text, "=> https://example.com") assert_includes(html_text, "=> https://example.org") assert_includes(markdown_text, "=> /posts Back to posts") - assert_includes(archive_text, "# samhuri.net posts") - assert_includes(archive_text, "## Feed") - assert_match(%r{=> /posts/2025/11/link-post/ 2025-11-07 - Link Post\n=> https://example.net/story}, archive_text) - assert_includes(archive_text, "=> /posts/2025/11/html-heavy/ 2025-11-06 - HTML Heavy") - assert_includes(archive_text, "=> /posts/2025/11/markdown-only/ 2025-11-05 - Markdown Only") - assert_equal(archive_text, feed_text) + assert_includes(posts_text, "# samhuri.net posts") + assert_includes(posts_text, "## Feed") + assert_match(%r{=> /posts/2025/11/link-post/ 2025-11-07 - Link Post\n=> https://example.net/story}, posts_text) + assert_includes(posts_text, "=> /posts/2025/11/html-heavy/ 2025-11-06 - HTML Heavy") + assert_includes(posts_text, "=> /posts/2025/11/markdown-only/ 2025-11-05 - Markdown Only") + assert_equal(posts_text, feed_text) end end end diff --git a/test/posts/writer_test.rb b/test/posts/writer_test.rb index 15fd95f..907cd41 100644 --- a/test/posts/writer_test.rb +++ b/test/posts/writer_test.rb @@ -84,14 +84,14 @@ class Pressa::Posts::PostWriterTest < Minitest::Test end end - def test_write_archive_writes_archive_index + def test_write_posts_archive_writes_posts_index Dir.mktmpdir do |dir| - writer.write_archive(target_path: dir) + writer.write_posts_archive(target_path: dir) - archive_path = File.join(dir, "posts/index.html") - assert(File.exist?(archive_path)) - html = File.read(archive_path) - assert_includes(html, "Archive") + posts_path = File.join(dir, "posts/index.html") + assert(File.exist?(posts_path)) + html = File.read(posts_path) + assert_includes(html, "Posts") assert_includes(html, "https://samhuri.net/posts/2025/") end end diff --git a/test/views/rendering_test.rb b/test/views/rendering_test.rb index 5e1cc37..26b18d3 100644 --- a/test/views/rendering_test.rb +++ b/test/views/rendering_test.rb @@ -95,7 +95,7 @@ class Pressa::Views::RenderingTest < Minitest::Test assert_includes(details, "https://github.com/samsonjs/demo/network/members") end - def test_archive_views_render_year_month_and_both_post_types + def test_posts_views_render_year_month_and_both_post_types may_posts = Pressa::Posts::MonthPosts.new( month: Pressa::Posts::Month.new(name: "May", number: 5, padded: "05"), posts: [link_post] @@ -114,7 +114,7 @@ class Pressa::Views::RenderingTest < Minitest::Test year_html = Pressa::Views::YearPostsView.new(year: 2015, year_posts: by_year[2015], site:).call month_html = Pressa::Views::MonthPostsView.new(year: 2017, month_posts: oct_posts, site:).call recent_html = Pressa::Views::RecentPostsView.new(posts: [regular_post], site:).call - archive_html = Pressa::Views::ArchiveView.new(posts_by_year:, site:).call + posts_html = Pressa::Views::ArchiveView.new(posts_by_year:, site:).call assert_includes(year_html, "https://samhuri.net/posts/2015/05/") assert_includes(year_html, "→ GitHub Flow Like a Pro") @@ -122,8 +122,8 @@ class Pressa::Views::RenderingTest < Minitest::Test assert_includes(month_html, "October 2017") assert_includes(recent_html, "Swift Optional OR") - assert_includes(archive_html, "Archive") - assert_includes(archive_html, "https://samhuri.net/posts/2017/") - assert_includes(archive_html, "https://samhuri.net/posts/2015/") + assert_includes(posts_html, "Posts") + assert_includes(posts_html, "https://samhuri.net/posts/2017/") + assert_includes(posts_html, "https://samhuri.net/posts/2015/") end end