Repos / hi.imnhan.com / 6fb719ab9b
commit 6fb719ab9b27568aabefc8ae146aa3b2d460b4f0
Author: Bùi Thành Nhân <hi@imnhan.com>
Date:   Mon Jan 31 15:37:49 2022 +0700

    add og thumbnail + description via summary

diff --git a/content/images/byte_databases.jpg b/content/images/byte_databases.jpg
new file mode 100644
index 0000000..600f346
Binary files /dev/null and b/content/images/byte_databases.jpg differ
diff --git a/content/posts/working-with-sqlite-without-an-orm.md b/content/posts/working-with-sqlite-without-an-orm.md
index 89b8b3f..2277605 100644
--- a/content/posts/working-with-sqlite-without-an-orm.md
+++ b/content/posts/working-with-sqlite-without-an-orm.md
@@ -1,8 +1,11 @@
 Title: Working with SQLite in Python without an ORM or migration framework
 Date: 2022-01-30 14:11
-Summary: |
-    Some notes on handling migrations, linking the latest SQLite, and sane
-    driver defaults.
+Summary: Some notes on handling migrations, linking the latest SQLite,
+         and sane driver defaults.
+Thumb: images/byte_databases.jpg
+
+![byte-magazine-databases](/images/byte_databases.jpg "")
+_[(seriously though, BYTE covers are the best)][18]_
 
 
 I learned about SQLite's user_version pragma some time ago from a comment on
@@ -193,3 +196,4 @@ # Use the parameter substitution API instead:
 [15]: https://www.sqlite.org/lang_altertable.html#otheralter
 [16]: https://vnhacker.blogspot.com/2021/08/bkav-bi-hack-nhu-nao.html
 [17]: https://docs.python.org/3/library/sqlite3.html
+[18]: https://archive.org/details/byte-magazine
diff --git a/nhanb-theme/templates/article.html b/nhanb-theme/templates/article.html
index dcf2f51..cbe8901 100644
--- a/nhanb-theme/templates/article.html
+++ b/nhanb-theme/templates/article.html
@@ -9,7 +9,7 @@
   <meta name="twitter:card" content="summary" />
   <meta name="twitter:creator" content="@nhanbt" />
   <meta property="og:title" content="{{ article.title|striptags }}" />
-  <meta property="og:description" content="{{ article.content|striptags|truncate(255) }}" />
+  <meta property="og:description" content="{{ (article.summary or article.content) |striptags|truncate(255) }}" />
 
   {% if article.thumb %}
     <meta property="og:image" content="{{ SITEURL }}/{{ article.thumb }}" />