From 4568792f8929e611470f39d4d7c5149425f8eebc Mon Sep 17 00:00:00 2001 From: David Morrow Date: Mon, 8 Jan 2024 15:19:19 -0800 Subject: [PATCH 1/5] dynamically loading the "whats new" --- content/{index.html => index.html.erb} | 48 +++++++++++++++----------- lib/default.rb | 9 +++++ 2 files changed, 37 insertions(+), 20 deletions(-) rename content/{index.html => index.html.erb} (70%) diff --git a/content/index.html b/content/index.html.erb similarity index 70% rename from content/index.html rename to content/index.html.erb index affe76e0..8257c9b3 100644 --- a/content/index.html +++ b/content/index.html.erb @@ -9,55 +9,55 @@

Get your DNS hosting and domains set up and running quick +<% featured = blog_articles %> + - diff --git a/lib/default.rb b/lib/default.rb index dd2fc1fd..22693c42 100644 --- a/lib/default.rb +++ b/lib/default.rb @@ -21,3 +21,12 @@ def pretty_print_fixture(filename) body = response.read_body body ? JSON.pretty_generate(JSON.parse(body)) : nil end + +def blog_articles + uri = URI('https://blog.dnsimple.com/feed.json') + # uri = URI('http://localhost:4000/feed.json') + res = Net::HTTP.get(uri) + feed = JSON.parse(res, { symbolize_names: true }) + + feed[:items].select { |item| item[:tags].downcase.include? "feature" } +end From 4a558af60c84e984f250287eeffca9dd0fbbe844 Mon Sep 17 00:00:00 2001 From: David Morrow Date: Tue, 9 Jan 2024 13:24:58 -0800 Subject: [PATCH 2/5] ensuring that there is an illustration for the main feature --- content/index.html.erb | 25 +++++++++++-------------- lib/default.rb | 10 ++++++++-- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/content/index.html.erb b/content/index.html.erb index 8257c9b3..1cc18119 100644 --- a/content/index.html.erb +++ b/content/index.html.erb @@ -96,29 +96,26 @@ excerpt: Use DNSimple API to get your domains and DNS hosting set up and running diff --git a/lib/default.rb b/lib/default.rb index 22693c42..bea2ec55 100644 --- a/lib/default.rb +++ b/lib/default.rb @@ -24,9 +24,15 @@ def pretty_print_fixture(filename) def blog_articles uri = URI('https://blog.dnsimple.com/feed.json') - # uri = URI('http://localhost:4000/feed.json') res = Net::HTTP.get(uri) feed = JSON.parse(res, { symbolize_names: true }) + features = feed[:items].select { |item| item[:tags].downcase.include? "feature" } - feed[:items].select { |item| item[:tags].downcase.include? "feature" } + main = features.find { |item| item[:illustration] } + secondary = features.select { |item| item[:title] != main[:title] } + + { + main:, + secondary: secondary.take(2) + } end From 4ec020cf656d5e7dcc68bb9497d3674affd91ba8 Mon Sep 17 00:00:00 2001 From: David Morrow Date: Tue, 9 Jan 2024 13:31:43 -0800 Subject: [PATCH 3/5] do not infer hash key whatever ruby is doing the deploy does not like that --- lib/default.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/default.rb b/lib/default.rb index bea2ec55..016a93d0 100644 --- a/lib/default.rb +++ b/lib/default.rb @@ -32,7 +32,7 @@ def blog_articles secondary = features.select { |item| item[:title] != main[:title] } { - main:, + main: main, secondary: secondary.take(2) } end From 64b2b523758f5231535f92beaa8a65cc8a8860f1 Mon Sep 17 00:00:00 2001 From: David Morrow Date: Wed, 21 Feb 2024 11:30:03 -0800 Subject: [PATCH 4/5] img tags do not need closed --- content/index.html.erb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/content/index.html.erb b/content/index.html.erb index 1cc18119..f5544faf 100644 --- a/content/index.html.erb +++ b/content/index.html.erb @@ -9,55 +9,55 @@ excerpt: Use DNSimple API to get your domains and DNS hosting set up and running
From 845f5beaad627063d719bbedc0e4613ff4eec828 Mon Sep 17 00:00:00 2001 From: David Morrow Date: Wed, 21 Feb 2024 11:35:16 -0800 Subject: [PATCH 5/5] reverting formatting changes --- content/index.html.erb | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/content/index.html.erb b/content/index.html.erb index f5544faf..a784b6e9 100644 --- a/content/index.html.erb +++ b/content/index.html.erb @@ -99,7 +99,7 @@ excerpt: Use DNSimple API to get your domains and DNS hosting set up and running