The Self Discovery Channel on YouTube

I post videos discussing software, creativity, media, and video essays and short films. Please subscribe!

The above video goes over Jinja templates and using them to customize your highlights from into your Obsidian vault and some tips to get the most out of exports and how highlights taken from Readwise proper and Reader differ.

Jinja Templating Engine

Readwise uses Jinja for manipulating the highlights and other data taken from the items you add to Readwise. Through Jinja you can use if/then statements and text filters to fine tune the way your Obsidian highlight notes look.

Obsidian Export Templates

File Name

{{title|replace("#", "")|replace(";"," -")}} - {{author}}

The first section will take the {{title}} variable from Readwise and replace all instances of "#" with "", effectively removing them then it will go through the modified version of the {{title}} variable and replace all ";" with " -". For me, these were the most common characters popping up that were causing issues with file names in Obsidian notes. Chaining more |replace filters will let you continue to swap or remove characters.

Page Metadata

{% if is_new_page %} {% if image_url -%} ![rw-book-cover|400]({{image_url}}) {% endif -%}{% endif -%}

The only change I made to the default value in this section is adding the '|400' after the embed image link. This will tell Obsidian to scale the image down to 400px width.

Highlights Header

{% if is_new_page %} > [!INFO]+ > categorization:: {% for tag in document_tags %}#Subject/{{tag}} {% endfor %} > classification:: #Source/{{"videos" if '' in url else category }} > author:: {% if author %}[[{{author}}]]{% endif %} > url:: {{url}} > date:: [[{{last_highlighted_date|date('Y-m-d')}}]] # Highlights {% elif has_new_highlights -%} ## New highlights added [[{{date|date('Y-m-d')}}]] {% endif -%}

Here we have a collapsible call out that will insert Obsidian tags (Starting with #Subject) for each Readwise tag added to the document. So tagging an article in Readwise as "Ghosties" will translate to a nested Obsidian tag of #Subject/Ghosties. For the #Source tag, which I use to track the type of item that is being highlighted, I have Readwise insert the type category that it internally uses unless the url of the item has '' in it. This is because Readwise's Reader app, that you can use to highlight transcripts of online video, does not translate t a 'video' category in Readwise proper, which is what is actually doing the exporting.


> [!QUOTE]+ > {{ highlight_text|replace("#", "+") }}{% if highlight_location and highlight_location_url %} ([{{highlight_location}}]({{highlight_location_url}})){% elif highlight_location %} ({{highlight_location}}){% endif %} ^rw{{highlight_id}} {% if highlight_tags %} > [!IMPORTANT] Highlight Metadata > Tags: {% for tag in highlight_tags %}[[{{tag}}]] {% endfor %}{% endif %} {% if highlight_note %}> Note: {{ highlight_note|replace("#", "")|replace(":"," -") }}{% endif %}

YAML Front Matter

title: "{{title|replace("#", "")|replace(":"," -")}}" moment: <%"hh:mm:ss") %> icon: {{"📼" if '' in url else "📚" if category == "books" else "📰" if category == "articles" else "🐦" if category == "tweets" else "🎙" if category == "podcasts"}}

Sync Notification

I leave this disabled but I'm sure with some effort I could create a template for this note that would be useful in some way.

Great! Next, complete checkout for full access to Animal Cracker Studios.
Welcome back! You've successfully signed in.
You've successfully subscribed to Animal Cracker Studios.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.