danielmochdotcom

Nikola site for www.danielmoch.com
git clone git://git.danielmoch.com/danielmochdotcom.git
Log | Files | Refs

commit cae3a50f5d5ba5aab5c83a20a9356753ece40654
parent 89c1a1a48bd7d597a692624fbc4b090cdfe55a4a
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Fri, 19 Jul 2019 05:09:44 -0400

Use JPG for og:image

Diffstat:
Mconf.py | 2++
Afiles/assets/initials-blue.jpg | 0
Mposts/2017/02/how-sadness-could-save-the-world.rst | 1-
Mposts/2018/03/a-eulogy-for-my-grandmother.rst | 1-
Mposts/2018/03/structural-problems-with-for-profit-social-media.rst | 1-
Mposts/2018/03/traveling-with-the-good-and-the-bad.rst | 1-
Mposts/2018/04/facebook-defends-universal-data-collection.rst | 1-
Mposts/2018/04/the-mozilla-foundation-on-a-healthy-internet.rst | 1-
Mposts/2018/06/a-letter-to-senator-rubio.rst | 1-
Mposts/2018/10/getting-started-on-mastodon.rst | 1-
Mposts/2018/10/hardening-services-with-systemd.rst | 1-
Mposts/2018/10/new-website-backend.rst | 1-
Mposts/2018/11/zsh-compinit-rtfm.rst | 1-
Mposts/2018/12/you-should-be-using-tags-in-vim.rst | 1-
Mposts/2019/07/using-qemu-without-pulling-your-hair-out.rst | 1-
Mthemes/djmoch/templates/index_helper.tmpl | 2+-
Athemes/djmoch/templates/post_helper.tmpl | 91+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
17 files changed, 94 insertions(+), 14 deletions(-)

diff --git a/conf.py b/conf.py @@ -342,6 +342,7 @@ # The URL may be relative to the site root. LOGO_URL = '/assets/initials-blue.png' AVATAR_URL = '/assets/avatar.jpg' +DEFAULT_POST_IMAGE_URL = '/assets/initials-blue.jpg' # If you want to hide the title of your website (for example, if your logo # already contains the text), set this to False. @@ -1365,6 +1366,7 @@ "sidebar_links": SIDEBAR_LINKS, "biography": BIOGRAPHY, "avatar_url": AVATAR_URL, + "default_post_image_url": DEFAULT_POST_IMAGE_URL, "license_info": LICENSE_INFO, } diff --git a/files/assets/initials-blue.jpg b/files/assets/initials-blue.jpg Binary files differ. diff --git a/posts/2017/02/how-sadness-could-save-the-world.rst b/posts/2017/02/how-sadness-could-save-the-world.rst @@ -4,7 +4,6 @@ .. category: politics .. type: text .. description: It seems like everywhere I turn people are angry. -.. previewimage: /assets/initials-blue.png Anger is my first response when things go wrong. If that surprises you, the shock will wear off as soon as I tell you that I grew up in New York diff --git a/posts/2018/03/a-eulogy-for-my-grandmother.rst b/posts/2018/03/a-eulogy-for-my-grandmother.rst @@ -4,7 +4,6 @@ .. category: personal .. type: text .. description: A eulogy for Jane Marie Moch -.. previewimage: /assets/initials-blue.png Jane Marie Moch, who I had the privilege for the past 35 years of calling Gram, was born March 11, 1937 and died this past Sunday on her diff --git a/posts/2018/03/structural-problems-with-for-profit-social-media.rst b/posts/2018/03/structural-problems-with-for-profit-social-media.rst @@ -4,7 +4,6 @@ .. category: technology .. type: text .. description: Zeynep Tufekci nails the structural problems with social media -.. previewimage: /assets/initials-blue.png Many of you who know me personally know that I've become increasingly concerned with online privacy over the past few years. It's a topic that diff --git a/posts/2018/03/traveling-with-the-good-and-the-bad.rst b/posts/2018/03/traveling-with-the-good-and-the-bad.rst @@ -4,7 +4,6 @@ .. category: personal .. type: text .. description: Things I'm thankful for when I'm on the road. -.. previewimage: /assets/initials-blue.png Things I'm Thankful For When Traveling -------------------------------------- diff --git a/posts/2018/04/facebook-defends-universal-data-collection.rst b/posts/2018/04/facebook-defends-universal-data-collection.rst @@ -4,7 +4,6 @@ .. category: security .. type: text .. description: Facebook resorts to finger-pointing to defend collecting data on non-users -.. previewimage: /assets/initials-blue.png Since June of last year, Facebook has been publishing a series called Hard Questions. In the latest installment in that series, David Baser, diff --git a/posts/2018/04/the-mozilla-foundation-on-a-healthy-internet.rst b/posts/2018/04/the-mozilla-foundation-on-a-healthy-internet.rst @@ -4,7 +4,6 @@ .. category: technology .. type: text .. description: Mozilla's report calls out Web illiteracy as a major problem -.. previewimage: /assets/initials-blue.png Sean Gallagher over at Ars Technica reported_ yesterday on the 2018 `Internet Health Report`_, which Mozilla puts together. I'm linking the diff --git a/posts/2018/06/a-letter-to-senator-rubio.rst b/posts/2018/06/a-letter-to-senator-rubio.rst @@ -4,7 +4,6 @@ .. category: politics .. type: text .. description: Children should never be separated from their children -.. previewimage: /assets/initials-blue.png Senator Rubio, diff --git a/posts/2018/10/getting-started-on-mastodon.rst b/posts/2018/10/getting-started-on-mastodon.rst @@ -4,7 +4,6 @@ .. category: technology .. type: text .. description: Tips for making the most of your experience on the Fediverse -.. previewimage: /assets/initials-blue.png If I've identified a trend in my social media preferences, it's that I prefer not to use social media. That's not to say that I *don't* use it, diff --git a/posts/2018/10/hardening-services-with-systemd.rst b/posts/2018/10/hardening-services-with-systemd.rst @@ -4,7 +4,6 @@ .. category: technology .. type: text .. description: More secure services are an out-of-the-box feature with Systemd -.. previewimage: /assets/initials-blue.png Systemd gets a lot of hate. There's a lot of heat and very little light in those discussions, in my opinion, and I don't expect that this post diff --git a/posts/2018/10/new-website-backend.rst b/posts/2018/10/new-website-backend.rst @@ -4,7 +4,6 @@ .. category: technology .. type: text .. description: I've moved from a Django site to a static one powered by Nikola -.. previewimage: /assets/initials-blue.png For those interested, I've converted this website over from a Django_ backend to Nikola_. Since there aren't any interactive features on this diff --git a/posts/2018/11/zsh-compinit-rtfm.rst b/posts/2018/11/zsh-compinit-rtfm.rst @@ -4,7 +4,6 @@ .. category: technology .. type: text .. description: Slow start times in Zsh are probably a sign of poor configuration -.. previewimage: /assets/initials-blue.png This week I dealt with a problem that had been bugging me. I noticed that the time a took to start a new Zsh_ terminal session went from diff --git a/posts/2018/12/you-should-be-using-tags-in-vim.rst b/posts/2018/12/you-should-be-using-tags-in-vim.rst @@ -4,7 +4,6 @@ .. category: technology .. type: text .. description: You may not know it, but Vim already does what you installed a Jedi plugin to do -.. previewimage: /assets/initials-blue.png .. raw:: html diff --git a/posts/2019/07/using-qemu-without-pulling-your-hair-out.rst b/posts/2019/07/using-qemu-without-pulling-your-hair-out.rst @@ -4,7 +4,6 @@ .. category: technology .. description: Tips for keeping your sanity with a very powerful tool .. type: text -.. previewimage: /assets/initials-blue.png I make it a rule to choose my tools carefully and to invest the time to learn them deeply. QEMU has been one of those tools that I've wanted to learn how to diff --git a/themes/djmoch/templates/index_helper.tmpl b/themes/djmoch/templates/index_helper.tmpl @@ -23,7 +23,7 @@ <meta property="og:site_name" content="{{ blog_title|e }}"> <meta property="og:title" content="{{ blog_title|e }}"> <meta property="og:type" content="website"> -<meta property="og:image" content="{{ abs_link(logo_url) }}"> +<meta property="og:image" content="{{ abs_link(default_post_image_url) }}"> {% endmacro %} {% macro twitter_card_information(post) %} diff --git a/themes/djmoch/templates/post_helper.tmpl b/themes/djmoch/templates/post_helper.tmpl @@ -0,0 +1,91 @@ +{# -*- coding: utf-8 -*- #} +{% import 'math_helper.tmpl' as math with context %} + +{% macro meta_translations(post) %} + {% if translations|length > 1 %} + {% for langname in translations|sort %} + {% if langname != lang and ((not post.skip_untranslated) or post.is_translation_available(langname)) %} + <link rel="alternate" hreflang="{{ langname }}" href="{{ post.permalink(langname) }}"> + {% endif %} + {% endfor %} + {% endif %} +{% endmacro %} + +{% macro html_tags(post) %} + {% if post.tags %} + <ul itemprop="keywords" class="tags"> + {% for tag in post.tags %} + {% if tag not in hidden_tags %} + <li><a class="tag p-category" href="{{ _link('tag', tag) }}" rel="tag">{{ tag|e }}</a></li> + {% endif %} + {% endfor %} + </ul> + {% endif %} +{% endmacro %} + +{% macro html_pager(post) %} + {% if post.prev_post or post.next_post %} + <ul class="pager hidden-print"> + {% if post.prev_post %} + <li class="previous"> + <a href="{{ post.prev_post.permalink() }}" rel="prev" title="{{ post.prev_post.title()|e }}">{{ messages("Previous post") }}</a> + </li> + {% endif %} + {% if post.next_post %} + <li class="next"> + <a href="{{ post.next_post.permalink() }}" rel="next" title="{{ post.next_post.title()|e }}">{{ messages("Next post") }}</a> + </li> + {% endif %} + </ul> + {% endif %} +{% endmacro %} + +{% macro open_graph_metadata(post) %} +<meta property="og:site_name" content="{{ blog_title|e }}"> +<meta property="og:title" content="{{ post.title()[:70]|e }}"> +<meta property="og:url" content="{{ abs_link(permalink) }}"> +{% if post.description() %} + <meta property="og:description" content="{{ post.description()[:200]|e }}"> +{% else %} + <meta property="og:description" content="{{ post.text(strip_html=True)[:200]|e }}"> +{% endif %} +{% if post.previewimage %} + <meta property="og:image" content="{{ url_replacer(permalink, post.previewimage, lang, 'absolute') }}"> +{% else %} + <meta property="og:image" content="{{ abs_link(default_post_image_url) }}"> +{% endif %} +<meta property="og:type" content="article"> +{# Will only work with Pintrest and breaks everywhere else who expect a [Facebook] URI. #} +{# %if post.author(): #} +{# <meta property="article:author" content="{{ post.author()|e }}"> #} +{# %endif #} +{% if post.date.isoformat() %} + <meta property="article:published_time" content="{{ post.formatted_date('webiso') }}"> +{% endif %} +{% if post.tags %} + {% for tag in post.tags %} + <meta property="article:tag" content="{{ tag|e }}"> + {% endfor %} +{% endif %} +{% endmacro %} + +{% macro twitter_card_information(post) %} +{% if twitter_card and twitter_card['use_twitter_cards'] %} + <meta name="twitter:card" content="{{ twitter_card.get('card', 'summary')|e }}"> + {% if 'site:id' in twitter_card %} + <meta name="twitter:site:id" content="{{ twitter_card['site:id'] }}"> + {% elif 'site' in twitter_card %} + <meta name="twitter:site" content="{{ twitter_card['site'] }}"> + {% endif %} + {% if 'creator:id' in twitter_card %} + <meta name="twitter:creator:id" content="{{ twitter_card['creator:id'] }}"> + {% elif 'creator' in twitter_card %} + <meta name="twitter:creator" content="{{ twitter_card['creator'] }}"> + {% endif %} +{% endif %} +{% endmacro %} + +{# This function is deprecated; use math_helper directly. #} +{% macro mathjax_script(post) %} + {{ math.math_scripts_ifpost(post) }} +{% endmacro %}