From 0428b035d6131e2e29a61988603bedbc85de96a4 Mon Sep 17 00:00:00 2001 From: Bradley Taunt Date: Tue, 23 Jul 2024 09:40:14 -0400 Subject: Carry over core wruby changes --- _config.yml | 21 +++++++++++++++++++++ footer.html | 1 + header.html | 3 +-- pages/posts.md | 3 +++ wruby.rb | 59 +++++++++++++++++++++++++++++++++++++++------------------- 5 files changed, 66 insertions(+), 21 deletions(-) create mode 100644 _config.yml create mode 100644 pages/posts.md diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..992eed7 --- /dev/null +++ b/_config.yml @@ -0,0 +1,21 @@ +site_url: 'https://bt.srht.site' +site_name: 'bt' +author_name: 'Bradley Taunt' + +directories: + posts: 'posts' + pages: 'pages' + public: 'public' + output: 'build' + posts_output: 'build/posts' + pages_output: 'build/' + +files: + header: 'header.html' + footer: 'footer.html' + root_index: 'index.md' + posts_index: 'pages/posts.md' + rss: 'build/index.rss' + +misc: + post_count: 5 diff --git a/footer.html b/footer.html index 6d930c0..3f01220 100644 --- a/footer.html +++ b/footer.html @@ -4,6 +4,7 @@

Menu Navigation

\n

View all posts →

\n" + footer_content File.write("#{output_dir}/index.html", index_content) end -# Generate the RSS feed +# Create the full posts list page +def generate_full_posts_list(posts, header_content, footer_content, posts_index_file, output_dir, posts_dir) + posts_index_content = File.read(posts_index_file) + posts_title = extract_title_from_md(posts_index_content.lines) + posts_html = Kramdown::Document.new(posts_index_content).to_html + + header = replace_title_placeholder(header_content, posts_title) + + list_content = header + posts_html + "\n" + footer_content + + File.write("#{output_dir}/posts/index.html", list_content) +end + +# Generate the RSS 2.0 feed def generate_rss(posts, rss_file, author_name, site_name, site_url, posts_dir) rss = RSS::Maker.make("2.0") do |maker| maker.channel.author = author_name @@ -117,7 +137,8 @@ header_content = File.read(header_file) posts = process_markdown_files(posts_dir, posts_output_dir, header_content, footer_content).sort_by { |post| -post[:date].to_time.to_i } pages = process_markdown_files(pages_dir, pages_output_dir, header_content, footer_content) -generate_index(posts, header_content, footer_content, root_index_file, output_dir, posts_dir) +generate_index(posts, header_content, footer_content, root_index_file, post_count, output_dir, posts_dir) +generate_full_posts_list(posts, header_content, footer_content, posts_index_file, output_dir, posts_dir) FileUtils.cp_r(public_dir, output_dir) generate_rss(posts, rss_file, author_name, site_name, site_url, posts_dir) -- cgit v1.2.3-54-g00ecf