iTranslated by AI
Building a Custom Tumblr Theme
Since I recently migrated my blog from WordPress to Tumblr, I decided to take the opportunity to create a custom Tumblr theme.
While "custom themes" might sound complicated, Tumblr custom themes don't have a high degree of freedom, so a single simple template file is all you need.
What I built
Live Blog
Documentation
Official
Contains template documentation and a simple tutorial.
As a side note, the post format was unified to "Neue" in 2017.
Because of this, users who previously only posted text probably don't need to consider post types other than "Text" when creating templates (theoretically).
Since Neue is not yet the default on the web version, it's recommended to configure it to use the new editor.
Unofficial
LIG has published an article explaining how to create Tumblr themes with examples, so it's good to read alongside the official documentation.
However, since it's a 2014 article, some parts are outdated, such as the status of Japanese search support or the lack of support for {block:HomePage}.
Editor Settings
Although not explicitly stated in the official documentation (?), the theme samples appear to use syntax similar to Smarty.
Installing a Smarty extension in VSCode or other editors makes the code easier to read.
Base Template
As you read through the official tutorial, there is a section titled "Markup example for a completed theme," so it's a good idea to start by using that code as a base.
Additionally, the code for the default theme "Tumblr Official" can be helpful for reference, but the structure is a bit too complex to use as a base; it's better to treat it as reference code. (Since the code itself isn't officially distributed, I keep a copy in a place where I can easily refer to it.)
Deployment
To reflect changes made to the template file locally on Tumblr, you copy the code and paste it into the Tumblr theme editor. Apparently, there are more sophisticated ways to synchronize them, but I haven't implemented any since I'm fine with the copy-paste deployment method.
Pain Points
- if/else and not syntax are not supported.
- Since it's impossible to extract only the thumbnail image URL (from the post body), you have to write tricky CSS or JS to control the display.
Discussion
更新のスクラップ