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
|
title: Uploads
|
||||||
output: true
|
output: true
|
||||||
|
|
||||||
|
title_photos: Dan Barber – Photos
|
||||||
|
|
||||||
author: Dan Barber
|
author: Dan Barber
|
||||||
markdown: Kramdown
|
markdown: Kramdown
|
||||||
description: Web designer and developer for thoughtbot in London. Drummer and all
|
description: Web designer and developer for thoughtbot in London. Drummer and all
|
||||||
@ -92,7 +94,6 @@ picture:
|
|||||||
width: 300
|
width: 300
|
||||||
height: 300
|
height: 300
|
||||||
|
|
||||||
|
|
||||||
full-width:
|
full-width:
|
||||||
ppi: [1, 2]
|
ppi: [1, 2]
|
||||||
attr:
|
attr:
|
||||||
|
|||||||
@ -54,7 +54,10 @@
|
|||||||
|
|
||||||
<meta property="og:title" content="{{ page.title }}">
|
<meta property="og:title" content="{{ page.title }}">
|
||||||
<meta property="og:url" content="{{ site.url }}{{ page.url }}">
|
<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:locale" content="en_UK">
|
||||||
<meta property="og:type" content="article">
|
<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 }}
|
, "url": {{ post_author_uri | jsonify }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
},
|
},
|
||||||
"tags": {{ post.tags | jsonify }}
|
"tags": {{ post.tags | uniq | jsonify }}
|
||||||
}{% unless forloop.last == true %},{% endunless %}
|
}{% unless forloop.last == true %},{% endunless %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -5,7 +5,7 @@ layout:
|
|||||||
{
|
{
|
||||||
"version": "https://jsonfeed.org/version/1",
|
"version": "https://jsonfeed.org/version/1",
|
||||||
{% if site.title %}
|
{% if site.title %}
|
||||||
"title": {{ site.title | smartify | jsonify }},
|
"title": {{ site.title_photos | smartify | jsonify }},
|
||||||
{% elsif site.name %}
|
{% elsif site.name %}
|
||||||
"title": {{ site.name | smartify | jsonify }},
|
"title": {{ site.name | smartify | jsonify }},
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -41,7 +41,7 @@ layout:
|
|||||||
{% unless post_image contains "://" %}
|
{% unless post_image contains "://" %}
|
||||||
{% assign post_image = post_image | absolute_url | xml_escape %}
|
{% assign post_image = post_image | absolute_url | xml_escape %}
|
||||||
{% endunless %}
|
{% endunless %}
|
||||||
"image": {{ post_image | jsonify }},
|
"image": {{ post.image | magick: resize: "2097152@" | absolute_url | jsonify }},
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% assign post_banner_image = post.banner_image.path | default: post.banner_image %}
|
{% assign post_banner_image = post.banner_image.path | default: post.banner_image %}
|
||||||
{% if post_banner_image %}
|
{% if post_banner_image %}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ layout:
|
|||||||
|
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
<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 }}/atom.xml" rel="self"/>
|
||||||
<link href="{{ site.url }}/"/>
|
<link href="{{ site.url }}/"/>
|
||||||
<updated>{{ site.time | date_to_xmlschema }}</updated>
|
<updated>{{ site.time | date_to_xmlschema }}</updated>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user