Rename Archive to Posts

This commit is contained in:
Sami Samhuri 2026-06-21 19:43:52 -07:00
parent 2b3a9b3947
commit 93be8ad37d
9 changed files with 31 additions and 31 deletions

View file

@ -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:)

View file

@ -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"

View file

@ -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|

View file

@ -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

View file

@ -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

View file

@ -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;
}
}

View file

@ -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

View file

@ -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

View file

@ -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