danielmochdotcom

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

commit a4b7504430b400936e2a51528fd9336612f2bafa
parent 2ab74dccfb93af705eba22b00d8bd4e9e563c451
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Sun, 16 Dec 2018 15:31:23 -0500

Enable OpenGraph/Twitter cards

Diffstat:
Mconf.py | 19++++++++++---------
Afiles/assets/initials-plus-white-bg.png | 0
Mposts/2017/02/how-sadness-could-save-the-world.rst | 2++
Mposts/2018/03/a-eulogy-for-my-grandmother.rst | 2++
Mposts/2018/03/structural-problems-with-for-profit-social-media.rst | 2++
Mposts/2018/03/traveling-with-the-good-and-the-bad.rst | 2++
Mposts/2018/04/facebook-defends-universal-data-collection.rst | 2++
Mposts/2018/04/the-mozilla-foundation-on-a-healthy-internet.rst | 2++
Mposts/2018/06/a-letter-to-senator-rubio.rst | 2++
Mposts/2018/10/getting-started-on-mastodon.rst | 2++
Mposts/2018/10/hardening-services-with-systemd.rst | 2++
Mposts/2018/10/new-website-backend.rst | 2++
Mposts/2018/11/zsh-compinit-rtfm.rst | 2++
Mposts/2018/12/you-should-be-using-tags-in-vim.rst | 2++
Mthemes/djmoch/templates/base.tmpl | 92++++++++++++++++++++++++++++++++++++-------------------------------------------
Athemes/djmoch/templates/base_helper.tmpl | 116+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mthemes/djmoch/templates/index.tmpl | 10++++++----
Mthemes/djmoch/templates/post.tmpl | 36+++++++++++++++++++++++++-----------
Dthemes/djmoch/templates/post_base.tmpl | 7-------
19 files changed, 223 insertions(+), 81 deletions(-)

diff --git a/conf.py b/conf.py @@ -17,7 +17,7 @@ # Data about this site BLOG_AUTHOR = "Daniel Moch" # (translatable) -BLOG_TITLE = "Daniel Moch" # (translatable) +BLOG_TITLE = BLOG_AUTHOR # (translatable) # This is the main URL for your site. It will be used # in a prominent link. Don't forget the protocol (http/https)! SITE_URL = "https://danielmoch.com/" @@ -138,8 +138,9 @@ DEFAULT_LANG: ( ("/", "Home"), ("/projects", "Projects"), + ("https://git.danielmoch.com", "Git"), ("/blog", "Blog"), - ("/rss.xml", "RSS feed"), + ("/rss.xml", "RSS"), ), } @@ -1268,13 +1269,13 @@ # Uncomment and modify to following lines to match your accounts. # Images displayed come from the `previewimage` meta tag. # You can specify the card type by using the `card` parameter in TWITTER_CARD. -# TWITTER_CARD = { -# # 'use_twitter_cards': True, # enable Twitter Cards -# # 'card': 'summary', # Card type, you can also use 'summary_large_image', -# # see https://dev.twitter.com/cards/types -# # 'site': '@website', # twitter nick for the website -# # 'creator': '@username', # Username for the content creator / author. -# } +TWITTER_CARD = { + 'use_twitter_cards': True, # enable Twitter Cards + 'card': 'summary', # Card type, you can also use 'summary_large_image', + # see https://dev.twitter.com/cards/types + 'site': '@modusblogus', # twitter nick for the website + 'creator': '@_djmoch', # Username for the content creator / author. +} # Bundle JS and CSS into single files to make site loading faster in a HTTP/1.1 # environment but is not recommended for HTTP/2.0 when caching is used. diff --git a/files/assets/initials-plus-white-bg.png b/files/assets/initials-plus-white-bg.png 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 @@ -3,6 +3,8 @@ .. date: 2017-02-12 16:41:32 UTC-04:00 .. category: politics .. type: text +.. description: It seems like everywhere I turn people are angry. +.. previewimage: /assets/initials-plus-white-bg.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 @@ -3,6 +3,8 @@ .. date: 2018-03-18 15:37:52 UTC-04:00 .. category: personal .. type: text +.. description: A eulogy for Jane Marie Moch +.. previewimage: /assets/initials-plus-white-bg.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 @@ -3,6 +3,8 @@ .. date: 2018-03-22 16:30:06 UTC-04:00 .. category: technology .. type: text +.. description: Zeynep Tufekci nails the structural problems with social media +.. previewimage: /assets/initials-plus-white-bg.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 @@ -3,6 +3,8 @@ .. date: 2018-03-19 19:53:28 UTC-04:00 .. category: personal .. type: text +.. description: Things I'm thankful for when I'm on the road. +.. previewimage: /assets/initials-plus-white-bg.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 @@ -3,6 +3,8 @@ .. date: 2018-04-18 05:30:14 UTC-04:00 .. category: security .. type: text +.. description: Facebook resorts to finger-pointing to defend collecting data on non-users +.. previewimage: /assets/initials-plus-white-bg.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 @@ -3,6 +3,8 @@ .. date: 2018-04-11 06:40:06 UTC-04:00 .. category: technology .. type: text +.. description: Mozilla's report calls out Web illiteracy as a major problem +.. previewimage: /assets/initials-plus-white-bg.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 @@ -3,6 +3,8 @@ .. date: 2018-06-18 06:01:18 UTC-04:00 .. category: politics .. type: text +.. description: Children should never be separated from their children +.. previewimage: /assets/initials-plus-white-bg.png Senator Rubio, diff --git a/posts/2018/10/getting-started-on-mastodon.rst b/posts/2018/10/getting-started-on-mastodon.rst @@ -3,6 +3,8 @@ .. date: 2018-10-18 06:29:45 UTC-04:00 .. category: technology .. type: text +.. description: Tips for making the most of your experience on the Fediverse +.. previewimage: /assets/initials-plus-white-bg.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 @@ -3,6 +3,8 @@ .. date: 2018-10-05 09:13:03 UTC-04:00 .. category: technology .. type: text +.. description: More secure services are an out-of-the-box feature with Systemd +.. previewimage: /assets/initials-plus-white-bg.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 @@ -3,6 +3,8 @@ .. date: 2018-10-14 15:42:53 UTC-04:00 .. category: technology .. type: text +.. description: I've moved from a Django site to a static one powered by Nikola +.. previewimage: /assets/initials-plus-white-bg.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 @@ -3,6 +3,8 @@ .. date: 2018-11-09 06:04:08 UTC-05:00 .. category: technology .. type: text +.. description: Slow start times in Zsh are probably a sign of poor configuration +.. previewimage: /assets/initials-plus-white-bg.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 @@ -3,6 +3,8 @@ .. date: 2018-12-02 17:33:09 UTC-05:00 .. 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-plus-white-bg.png .. raw:: html diff --git a/themes/djmoch/templates/base.tmpl b/themes/djmoch/templates/base.tmpl @@ -1,54 +1,46 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <link href="/assets/open-sans.css" rel="stylesheet" type="text/css"> - <link href="/assets/bootstrap.min.css" rel="stylesheet"> - <link href="/assets/site.css" rel="stylesheet"> - <link href="/assets/css/code.css" rel="stylesheet"> - {% if title == blog_title %} - <title>{{ blog_title|e }}</title> - {% else %} - <title>{{ title|e }} | {{ blog_title|e }}</title> - {% endif %} - {% block head %}{% endblock %} - </head> - <body> - <header class="banner"> - <div class="container no-padding"> - {% if logo_url or show_blog_title -%} - <span class="col-xs-12 banner-title"> - {% if logo_url -%} - <img src="{{ logo_url }}" alt="{{ blog_title|e }}"> - {% endif -%} - {% if show_blog_title -%} - <span>{{ blog_title|e }}</span> - {% endif -%} - </span> +{# -*- coding: utf-8 -*- #} +{% import 'base_helper.tmpl' as base with context %} +{% import 'base_header.tmpl' as header with context %} +{{ set_locale(lang) }} +{# <html> tag is included by base.html_headstart #} +{{ base.html_headstart() }} +{% block extra_head %} +{# Leave this block alone. #} +{% endblock %} +{{ template_hooks['extra_head']() }} +</head> +<body> + <header class="banner"> + <div class="container no-padding"> + {% if logo_url or show_blog_title -%} + <span class="col-xs-12 banner-title"> + {% if logo_url -%} + <img src="{{ logo_url }}" alt="{{ blog_title|e }}"> {% endif -%} - <nav class="col-xs-12 banner-subtitle" style="display: flex;"> - <ul class="no-margin no-padding" style="margin-right: auto;"> - <li><a href="/">Home</a></li> - <li><a href="/projects">Projects</a></li> - <li><a href="https://git.danielmoch.com">Git</a></li> - <li><a href="/blog">Blog</a></li> - {% block nav %}{% endblock %} - </ul> - {% block nav_extra %}{% endblock %} - </nav> - </div> - </header> - <div class="container"> - <div class="row"> - <div class="col-xs-12 col-md-7 content"> - {% block content %}{% endblock %} - <em> - {% block footer %}{% endblock %} - </em> - </div> + {% if show_blog_title -%} + <span>{{ blog_title|e }}</span> + {% endif -%} + </span> + {% endif -%} + <nav class="col-xs-12 banner-subtitle" style="display: flex;"> + <ul class="no-margin no-padding" style="margin-right: auto;"> + {{ header.html_navigation_links_entries(navigation_links) }} + {{ header.html_navigation_links_entries(navigation_alt_links) }} + {{ template_hooks['menu']() }} + {{ template_hooks['menu_alt']() }} + </ul> + </nav> + </div> + </header> + <div class="container"> + <div class="row"> + <div class="col-xs-12 col-md-7 content"> + {% block content %}{% endblock %} + <em> + {% block footer %}{% endblock %} + </em> </div> </div> - </body> + </div> +</body> </html> diff --git a/themes/djmoch/templates/base_helper.tmpl b/themes/djmoch/templates/base_helper.tmpl @@ -0,0 +1,116 @@ +{# -*- coding: utf-8 -*- #} +{% import 'feeds_translations_helper.tmpl' as feeds_translations with context %} + +{% macro html_headstart() %} +<!DOCTYPE html> +<html \ + prefix=' + og: http://ogp.me/ns# article: http://ogp.me/ns/article# + {% if comment_system == 'facebook' %} + fb: http://ogp.me/ns/fb# + {% endif %} + ' \ + vocab="http://ogp.me/ns" \ +{% if is_rtl %} + dir="rtl" +{% endif %} + +lang="{{ lang }}"> +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + {% if description %} + <meta name="description" content="{{ description|e }}"> + {% endif %} + <meta name="viewport" content="width=device-width, initial-scale=1"> + {% if title == blog_title %} + <title>{{ blog_title|e }}</title> + {% else %} + <title>{{ title|e }} | {{ blog_title|e }}</title> + {% endif %} + + {{ html_stylesheets() }} + <meta name="theme-color" content="{{ theme_color }}"> + {% if meta_generator_tag %} + <meta name="generator" content="Nikola (getnikola.com)"> + {% endif %} + {{ feeds_translations.head(classification=None, kind='index', other=False) }} + <link rel="canonical" href="{{ abs_link(permalink) }}"> + + {% if favicons %} + {% for name, file, size in favicons %} + <link rel="{{ name }}" href="{{ file }}" sizes="{{ size }}"/> + {% endfor %} + {% endif %} + + {% if comment_system == 'facebook' %} + <meta property="fb:app_id" content="{{ comment_system_id }}"> + {% endif %} + + {% if prevlink %} + <link rel="prev" href="{{ prevlink }}" type="text/html"> + {% endif %} + {% if nextlink %} + <link rel="next" href="{{ nextlink }}" type="text/html"> + {% endif %} + + {% if use_cdn %} + <!--[if lt IE 9]><script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script><![endif]--> + {% else %} + <!--[if lt IE 9]><script src="{{ url_replacer(permalink, '/assets/js/html5shiv-printshiv.min.js', lang, url_type) }}"></script><![endif]--> + {% endif %} + + {{ extra_head_data }} +{% endmacro %} + +{% macro late_load_js() %} + {% if use_bundles %} + {% if use_cdn %} + <script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.11.0/baguetteBox.min.js" integrity="sha256-yQGjQhFs3LtyiN5hhr3k9s9TWZOh/RzCkD3gwwCKlkg=" crossorigin="anonymous"></script> + {% if date_fanciness != 0 %} + <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment-with-locales.min.js"></script> + {% endif %} + <script src="/assets/js/all.js"></script> + {% else %} + <script src="/assets/js/all-nocdn.js"></script> + {% endif %} + {% else %} + {% if use_cdn %} + <script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.11.0/baguetteBox.min.js" integrity="sha256-yQGjQhFs3LtyiN5hhr3k9s9TWZOh/RzCkD3gwwCKlkg=" crossorigin="anonymous"></script> + {% if date_fanciness != 0 %} + <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment-with-locales.min.js"></script> + {% endif %} + {% else %} + <script src="/assets/js/baguetteBox.min.js"></script> + {% if date_fanciness != 0 %} + <script src="/assets/js/moment-with-locales.min.js"></script> + {% endif %} + {% endif %} + {% if date_fanciness != 0 %} + <script src="/assets/js/fancydates.js"></script> + {% endif %} + {% endif %} + {{ social_buttons_code }} +{% endmacro %} + +{% macro html_stylesheets() %} + <link href="/assets/open-sans.css" rel="stylesheet" type="text/css"> + <link href="/assets/bootstrap.min.css" rel="stylesheet"> + <link href="/assets/site.css" rel="stylesheet"> + <link href="/assets/css/code.css" rel="stylesheet"> +{% endmacro %} + +{# This function is deprecated; use feed_helper directly. #} +{% macro html_feedlinks() %} + {{ feeds_translations.head(classification=None, kind='index', other=False) }} +{% endmacro %} + +{% macro html_translations() %} + <ul class="translations"> + {% for langname in translations|sort %} + {% if langname != lang %} + <li><a href="{{ abs_link(_link("root", None, langname)) }}" rel="alternate" hreflang="{{ langname }}">{{ messages("LANGUAGE", langname) }}</a></li> + {% endif %} + {% endfor %} + </ul> +{% endmacro %} diff --git a/themes/djmoch/templates/index.tmpl b/themes/djmoch/templates/index.tmpl @@ -1,11 +1,13 @@ {# -*- coding: utf-8 -*- #} {% import 'index_helper.tmpl' as helper with context %} {% import 'pagination_helper.tmpl' as pagination with context %} -{% extends "post_base.tmpl" %} +{% extends "base.tmpl" %} -{% block head %} - <link rel="canonical" href="https://www.danielmoch.com/blog"/> - <link rel="alternate" type="application/rss+xml" title="The blog of Daniel Moch" href="/rss.xml"> +{% block extra_head %} + {{ super() }} + {% if posts and (permalink == '/' or permalink == '/' + index_file) %} + <link rel="prefetch" href="{{ posts[0].permalink() }}" type="text/html"> + {% endif %} {% endblock %} {% block content %} diff --git a/themes/djmoch/templates/post.tmpl b/themes/djmoch/templates/post.tmpl @@ -1,15 +1,29 @@ -{% extends "post_base.tmpl" %} +{# -*- coding: utf-8 -*- #} +{% import 'post_helper.tmpl' as helper with context %} +{% import 'post_header.tmpl' as pheader with context %} +{% import 'comments_helper.tmpl' as comments with context %} +{% import 'math_helper.tmpl' as math with context %} +{% extends 'base.tmpl' %} -{% block head %} - <link rel="canonical" href="https://www.danielmoch.com/blog/{{post.permalink()}}"/> -{% endblock %} - -{% block nav_extra %} -{% if show_sourcelink %} -<ul class="no-margin no-padding" style="text-align: right;"> - <li><a href="{{ post.source_link() }}">Page Source</a></li> -</ul> -{% endif %} +{% block extra_head %} + {{ super() }} + {% if post.meta('keywords') %} + <meta name="keywords" content="{{ smartjoin(', ', post.meta('keywords'))|e }}"> + {% endif %} + <meta name="author" content="{{ post.author()|e }}"> + {% if post.prev_post %} + <link rel="prev" href="{{ post.prev_post.permalink() }}" title="{{ post.prev_post.title()|e }}" type="text/html"> + {% endif %} + {% if post.next_post %} + <link rel="next" href="{{ post.next_post.permalink() }}" title="{{ post.next_post.title()|e }}" type="text/html"> + {% endif %} + {% if post.is_draft %} + <meta name="robots" content="noindex"> + {% endif %} + {{ helper.open_graph_metadata(post) }} + {{ helper.twitter_card_information(post) }} + {{ helper.meta_translations(post) }} + {{ math.math_styles_ifpost(post) }} {% endblock %} {% block content %} diff --git a/themes/djmoch/templates/post_base.tmpl b/themes/djmoch/templates/post_base.tmpl @@ -1,7 +0,0 @@ -{% extends "base.tmpl" %} - -{% block nav %} -<li><a href="/categories">Categories</a></li> -<li><a href="/archive.html">Archive</a></li> -<li><a href="/rss.xml">RSS</a></li> -{% endblock %}