mirror of
https://github.com/danbee/danbarber.me
synced 2025-03-04 08:59:10 +00:00
Fix up feeds and OG data
This commit is contained in:
parent
2b923ed042
commit
8b02ea0428
@ -10,6 +10,8 @@ collections:
|
||||
title: Uploads
|
||||
output: true
|
||||
|
||||
title_photos: Dan Barber – Photos
|
||||
|
||||
author: Dan Barber
|
||||
markdown: Kramdown
|
||||
description: Web designer and developer for thoughtbot in London. Drummer and all
|
||||
@ -92,7 +94,6 @@ picture:
|
||||
width: 300
|
||||
height: 300
|
||||
|
||||
|
||||
full-width:
|
||||
ppi: [1, 2]
|
||||
attr:
|
||||
|
||||
@ -54,7 +54,10 @@
|
||||
|
||||
<meta property="og:title" content="{{ page.title }}">
|
||||
<meta property="og:url" content="{{ site.url }}{{ page.url }}">
|
||||
<meta property="og:description" content="{% if page.excerpt != nil %}{{ page.excerpt | strip_html | truncatewords:50 }}{% else %}{{ site.description }}{% endif %}">
|
||||
<meta property="og:description" content="{% if page.excerpt != nil %}{{ page.excerpt | strip_html | truncatewords:50 | strip }}{% else %}{{ site.description }}{% endif %}">
|
||||
{%- if page.image != nil %}
|
||||
<meta property="og:image" content="{{ page.image | magick: resize: "480000@" | absolute_url }}">
|
||||
{%- endif %}
|
||||
<meta property="og:locale" content="en_UK">
|
||||
<meta property="og:type" content="article">
|
||||
|
||||
|
||||
39
_plugins/minimagick.rb
Normal file
39
_plugins/minimagick.rb
Normal file
@ -0,0 +1,39 @@
|
||||
module Jekyll
|
||||
module MiniMagick
|
||||
def magick(image_path, options)
|
||||
filename, ext = image_path.split("/").last.split(".")
|
||||
|
||||
dest_path = image_path.
|
||||
split("/")[0..-2].
|
||||
prepend("assets").
|
||||
join("/")
|
||||
|
||||
options.each do |command, arg|
|
||||
filename += "_#{command}#{arg}"
|
||||
end
|
||||
|
||||
write_path = "#{dest_path}/#{filename}.#{ext}"
|
||||
|
||||
if File.exists?("_site/#{write_path}")
|
||||
return write_path
|
||||
end
|
||||
|
||||
image = ::MiniMagick::Image.open("_pictures/#{image_path}")
|
||||
|
||||
image.combine_options do |i|
|
||||
options.each do |command, arg|
|
||||
i.send command, arg
|
||||
end
|
||||
i.strip
|
||||
end
|
||||
|
||||
puts write_path
|
||||
|
||||
image.write "_site/#{write_path}"
|
||||
|
||||
write_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Liquid::Template.register_filter(Jekyll::MiniMagick)
|
||||
@ -59,7 +59,7 @@ layout:
|
||||
, "url": {{ post_author_uri | jsonify }}
|
||||
{% endif %}
|
||||
},
|
||||
"tags": {{ post.tags | jsonify }}
|
||||
"tags": {{ post.tags | uniq | jsonify }}
|
||||
}{% unless forloop.last == true %},{% endunless %}
|
||||
{% endfor %}
|
||||
]
|
||||
|
||||
@ -5,7 +5,7 @@ layout:
|
||||
{
|
||||
"version": "https://jsonfeed.org/version/1",
|
||||
{% if site.title %}
|
||||
"title": {{ site.title | smartify | jsonify }},
|
||||
"title": {{ site.title_photos | smartify | jsonify }},
|
||||
{% elsif site.name %}
|
||||
"title": {{ site.name | smartify | jsonify }},
|
||||
{% endif %}
|
||||
@ -41,7 +41,7 @@ layout:
|
||||
{% unless post_image contains "://" %}
|
||||
{% assign post_image = post_image | absolute_url | xml_escape %}
|
||||
{% endunless %}
|
||||
"image": {{ post_image | jsonify }},
|
||||
"image": {{ post.image | magick: resize: "2097152@" | absolute_url | jsonify }},
|
||||
{% endif %}
|
||||
{% assign post_banner_image = post.banner_image.path | default: post.banner_image %}
|
||||
{% if post_banner_image %}
|
||||
|
||||
@ -4,7 +4,7 @@ layout:
|
||||
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<title><![CDATA[{{ site.title }}]]></title>
|
||||
<title><![CDATA[{{ site.title_photos }}]]></title>
|
||||
<link href="{{ site.url }}/atom.xml" rel="self"/>
|
||||
<link href="{{ site.url }}/"/>
|
||||
<updated>{{ site.time | date_to_xmlschema }}</updated>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user