diff --git a/Gemfile b/Gemfile index 121f076ff38c..7d2559db02e3 100644 --- a/Gemfile +++ b/Gemfile @@ -18,3 +18,7 @@ group :jekyll_plugins do gem 'htmlcompressor' gem 'htmlbeautifier' end +group :other_plugins do + gem 'httparty' + gem 'feedjira' +end diff --git a/_config.yml b/_config.yml index b72c17fcdeee..a4e16c98281f 100644 --- a/_config.yml +++ b/_config.yml @@ -96,6 +96,13 @@ pagination: disqus_shortname: sandylaker # put your disqus shortname # https://help.disqus.com/en/articles/1717111-what-s-a-shortname +# External sources. +# If you have blog posts published on medium.com or other exteranl sources, +# you can display them in your blog by adding a link to the RSS feed. +external_sources: + - name: medium.com + rss_url: https://medium.com/@al-folio/feed + # ----------------------------------------------------------------------------- # Collections # ----------------------------------------------------------------------------- @@ -161,9 +168,9 @@ plugins: # Sitemap settings defaults: - scope: - path: "assets/**/*.*" + path: "assets/**/*.*" values: - sitemap: false + sitemap: false # Extras github: [metadata] @@ -174,10 +181,12 @@ github: [metadata] # HTML remove comments () remove_HTML_comments: false -# HTML beautifier (_plugins/beautify.rb) / https://github.com/threedaymonk/htmlbeautifier +# HTML beautifier (_plugins/beautify.rb). +# Source: https://github.com/threedaymonk/htmlbeautifier beautify: false # This function has conflict with the code snippets, they can be displayed incorrectly -# HTML minify (_plugins/minify.rb) Thanks to: https://www.ffbit.com/blog/2021/03/17/html-minification-in-jekyll.html +# HTML minify (_plugins/minify.rb). +# Source: https://www.ffbit.com/blog/2021/03/17/html-minification-in-jekyll.html minify: false # CSS/SASS minify @@ -189,7 +198,7 @@ sass: # ----------------------------------------------------------------------------- jekyll-archives: - enabled: [year, tags, categories] # enables year, tag and category archives (remove if you need to disable one of them). + enabled: [year, tags, categories] # enables year, tag and category archives (remove if you need to disable one of them). layouts: year: archive-year tag: archive-tag diff --git a/_plugins/external-posts.rb b/_plugins/external-posts.rb new file mode 100644 index 000000000000..e4fd5eb69517 --- /dev/null +++ b/_plugins/external-posts.rb @@ -0,0 +1,36 @@ +require 'feedjira' +require 'httparty' +require 'jekyll' + +module ExternalPosts + class ExternalPostsGenerator < Jekyll::Generator + safe true + priority :high + + def generate(site) + if site.config['external_sources'] != nil + site.config['external_sources'].each do |src| + p "Fetching external posts from #{src['name']}:" + xml = HTTParty.get(src['rss_url']).body + feed = Feedjira.parse(xml) + feed.entries.each do |e| + p "...fetching #{e.url}" + slug = e.title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '') + path = site.in_source_dir("_posts/#{slug}.md") + doc = Jekyll::Document.new( + path, { :site => site, :collection => site.collections['posts'] } + ) + doc.data['external_source'] = src['name']; + doc.data['feed_content'] = e.content; + doc.data['title'] = "#{e.title}"; + doc.data['description'] = e.summary; + doc.data['date'] = e.published; + doc.data['redirect'] = e.url; + site.collections['posts'].docs << doc + end + end + end + end + end + +end diff --git a/_sass/_base.scss b/_sass/_base.scss index e0ab9ceaffc8..d21521293326 100644 --- a/_sass/_base.scss +++ b/_sass/_base.scss @@ -64,7 +64,7 @@ blockquote { .card { background-color: var(--global-card-bg-color); - + img { width: 100%; } @@ -314,6 +314,7 @@ footer.sticky-bottom { color: var(--global-text-color-light); font-size: 0.875rem; padding-top: 0.25rem; + padding-bottom: 0; } a { color: var(--global-text-color); @@ -564,6 +565,7 @@ html.transition *:after { .post-tags{ color: var(--global-text-color-light); font-size: 0.875rem; + padding-top: 0.25rem; padding-bottom: 1rem; a { color: var(--global-text-color-light); @@ -574,15 +576,9 @@ html.transition *:after { } } .post-content{ - blockquote { - border-left: 5px solid var(--global-theme-color); - padding: 8px; - } -} -} - -.post-tags { - color: var(--global-text-color-light); - font-size: 0.875rem; - padding-top: 0.25rem; + blockquote { + border-left: 5px solid var(--global-theme-color); + padding: 8px; + } + } } diff --git a/blog/index.html b/blog/index.html index 4e2f16819da9..082e2e381cd6 100644 --- a/blog/index.html +++ b/blog/index.html @@ -5,7 +5,7 @@ enabled: true collection: posts permalink: /page/:num/ - per_page: 3 + per_page: 5 sort_field: date sort_reverse: true trail: @@ -24,7 +24,11 @@

{{ site.blog_description }}