Skip to content

Commit

Permalink
Minimum viable back button on all post pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
danott committed Jan 14, 2024
1 parent 14e7653 commit a0e53ca
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def includables
"DataDump" => Includable::DataDump,
"Index" => Includable::Index,
"PageDefaults" => Includable::PageDefaults,
"PostFooter" => Includable::PostFooter,
"SixWords" => Includable::SixWords
}
end
Expand Down
2 changes: 1 addition & 1 deletion lib/includable/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def template
<ul>
<% posts.each do |post| %>
<li>
<a href="<%= post.url %>"><%= post.date %>: <%= post.title %></a>
<a href="<%= post.url %>"><%= post.title %></a>
</li>
<% end %>
</ul>
Expand Down
12 changes: 12 additions & 0 deletions lib/includable/post_footer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Includable
class PostFooter
def initialize(string:, data:)
end

def render
<<~HTML
<a href="/">← Home</a>
HTML
end
end
end
6 changes: 5 additions & 1 deletion lib/magic_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ def initialize(path, original_content)

def content
if path.match(%r{site/\d\d\d\d/})
"<!--Include::PageDefaults-->\n\n" + original_content
[
"<!--Include::PageDefaults-->",
original_content,
"<!--Include::PostFooter-->"
].join("\n\n")
else
original_content
end
Expand Down
3 changes: 2 additions & 1 deletion lib/rss_target.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class RssTarget
AUTHOR = "Dan Ott".freeze
TITLE = "Dan Ott's RSS Feed".freeze
URL = "https://danott.website".freeze
FIRST_DANOTT_WEBSITE_POST_DATE = Date.parse("2024-01-13")

def write
File.write(TARGET_PATH, render)
Expand All @@ -13,7 +14,7 @@ def items
Build
.data
.posts
.select { |p| p.fetch("date") > Date.parse("2023-12-01") }
.select { |p| p.fetch("date") >= FIRST_DANOTT_WEBSITE_POST_DATE }
.map { |p| PostDataRssItem.new(p) }
end

Expand Down

0 comments on commit a0e53ca

Please sign in to comment.