Templates

Template system for customizing Spotify data insertion.

Template Types

Inline Templates

Direct string in settings:

'{{ song_name }}' by {{ artists }} from {{ album }} released in {{ album_release }}
{{ timestamp }}

File-based Templates

Reference to vault file:

Templates/Spotify/track.md

File contains same syntax as inline templates.

Variables

Track Variables

Basic Info

  • {{ song_name }} - Track title
  • {{ song_link }} - Markdown link with track name and artists
  • {{ song_url }} - Spotify URL (plain text)

Album

  • {{ album }} - Album name
  • {{ album_link }} - Markdown link to album
  • {{ album_url }} - Album Spotify URL
  • {{ album_release }} - Release date, format controlled by setting or inline override (see Date formatting)

Album Covers

  • {{ album_cover_large }} - Large cover as markdown image
  • {{ album_cover_medium }} - Medium cover as markdown image
  • {{ album_cover_small }} - Small cover as markdown image
  • {{ album_cover_link_large }} - Large cover as markdown link
  • {{ album_cover_link_medium }} - Medium cover as link
  • {{ album_cover_link_small }} - Small cover as link
  • {{ album_cover_url_large }} - Large cover URL (plain)
  • {{ album_cover_url_medium }} - Medium cover URL
  • {{ album_cover_url_small }} - Small cover URL

Image tokens accept an optional inline size override — see Image dimensions.

Artists

  • {{ artists }} - Comma-separated artist names
  • {{ artist_name }} - Same as artists
  • {{ artists_formatted:PREFIX:SUFFIX }} - Custom formatting
  • {{ main_artist_url }} - Primary artist API URL

Example formatted artists:

{{ artists_formatted:  - [[:]] }}

Output:

 - [[Artist One]]
 - [[Artist Two]]

Hashtag format:

{{ artists_formatted:#: }}

Output: #Artist_One #Artist_Two

Artist Metadata

  • {{ followers }} - Deprecated — renders _deprecated_. See Deprecated variables
  • {{ popularity }} - Deprecated — renders _deprecated_
  • {{ track_popularity }} - Deprecated — renders _deprecated_
  • {{ album_popularity }} - Deprecated — renders _deprecated_ when Spotify returns no value. Fetched via GET /v1/albums/{id}, only when the variable is present in the template
  • {{ artist_image }} - Artist images as markdown image (accepts inline size override, see Image dimensions)
  • {{ artist_image_link }} - Artist images as markdown link (no ! prefix)
  • {{ artist_image_url }} - Artist image URLs (plain text)
  • {{ genres }} - Comma-separated artist genres, deduplicated across all artists
  • {{ genres_array }} - Artist genre list formatted for YAML/Dataview arrays: "genre1", "genre2", deduplicated across all artists
  • {{ genres_hashtag }} - Artist genres as hashtags: #genre_one #genre_two, deduplicated across all artists
  • {{ genres_by_artist }} - Per-artist genre breakdown: Artist1: genre1, genre2 | Artist2: genre3. Separator defaults to |. Use {{ genres_by_artist:SEP }} to override — e.g. {{ genres_by_artist:; }} outputs Artist1: genre1, genre2;Artist2: genre3. Trailing whitespace in the separator is trimmed.
  • {{ album_genres }} - Deprecated — album genres are empty for practically every album, so this renders _deprecated_ unless Spotify returns some
  • {{ album_genres_array }} - Deprecated — as above, YAML/Dataview array form
  • {{ album_genres_hashtag }} - Deprecated — as above, hashtag form

Playlists

  • {{ playlists }} - Comma-separated names of the user’s owned playlists that contain the current track, plus “Liked Songs” if saved. Requires playlist-read-private and user-library-read scopes (included in the default scope for new installations). Only fetched when the token is present in the template.

Performance note: The Spotify API does not provide a way to look up which playlists contain a given track. The plugin must scan each of your owned playlists individually, which can be slow depending on how many playlists you have and how many tracks they contain. The scan runs in parallel batches (configurable via the Playlist concurrency setting) to minimize wait time. A notification shows progress and reports the total time when complete.

Timestamps

  • {{ timestamp }} - Local date and time
  • {{ timestampz }} - UTC ISO format
  • {{ timestamp(YYYY-MM-DD) }} - Custom date format
  • {{ timestamp(HH:mm) }} - Custom time format
  • {{ timestamp(YYYY-MM-DD HH:mm) }} - Combined format
  • {{ timestampz(...) }} - UTC variants

Episode Variables

Basic Info

  • {{ episode_name }} - Episode title
  • {{ episode_link }} - Markdown link to episode
  • {{ episode_url }} - Episode Spotify URL (plain text)
  • {{ description }} - Full description
  • {{ description[100] }} - Truncated to 100 chars (adds ...)
  • {{ release_date }} - Release date, format controlled by setting or inline override (see Date formatting)

Episode Covers

  • {{ episode_cover_large }} - Large cover as markdown image
  • {{ episode_cover_medium }} - Medium cover as markdown image
  • {{ episode_cover_small }} - Small cover as markdown image
  • {{ episode_cover_link_large }} - Large cover as link
  • {{ episode_cover_link_medium }} - Medium cover as link
  • {{ episode_cover_link_small }} - Small cover as link
  • {{ episode_cover_url_large }} - Large cover URL (plain)
  • {{ episode_cover_url_medium }} - Medium cover URL
  • {{ episode_cover_url_small }} - Small cover URL

Image tokens accept an optional inline size override — see Image dimensions.

Show Info

  • {{ show_name }} - Podcast name
  • {{ show_link }} - Spotify URL for show
  • {{ show_description }} - Podcast description
  • {{ publisher }} - Podcast publisher
  • {{ total_episodes }} - Total episode count

Playback

  • {{ duration_ms }} - Episode duration in milliseconds
  • {{ progress_ms }} - Current position in milliseconds
  • {{ progress_sec }} - Current position in seconds
  • {{ progress_min_sec }} - Formatted as “MM:SS”
  • {{ audio_preview_url }} - Preview audio URL (if available)

Timestamps

Same format as track timestamps (see above).

All Playlists Variables

Used with the “all playlists” commands. Each token is replaced per playlist.

Basic Info

  • {{ playlist_name }} - Playlist name
  • {{ playlist_link }} - Markdown link to playlist on Spotify
  • {{ playlist_url }} - Spotify URL (plain text, open.spotify.com)
  • {{ playlist_description }} - Playlist description
  • {{ playlist_track_count }} - Number of tracks in the playlist

Covers

  • {{ playlist_cover_large }} - Largest cover as markdown image
  • {{ playlist_cover_small }} - Smallest cover as markdown image
  • {{ playlist_cover_url }} - Largest cover URL (plain text)

Image tokens accept an optional inline size override — see Image dimensions.

Metadata

  • {{ playlist_owner }} - Owner display name
  • {{ playlist_public }} - true or false
  • {{ playlist_collaborative }} - true or false

Example output for {{ playlist_name }} ({{ playlist_track_count }} tracks) — {{ playlist_url }}:

My Favorites (142 tracks) — https://open.spotify.com/playlist/abc123

Example output for {{ playlist_link }}:

[My Favorites](https://open.spotify.com/playlist/abc123)

Cover images — size variants:

No size (full width):

{{ playlist_cover_large }}
→ ![My Favorites](https://mosaic.scdn.co/image/abc123)

Inline size override:

{{ playlist_cover_large|200x200 }}
→ ![My Favorites|200x200](https://mosaic.scdn.co/image/abc123)

Width only:

{{ playlist_cover_small|100 }}
→ ![My Favorites|100](https://mosaic.scdn.co/image/abc123-small)

Inside a Markdown table (escaped pipe):

| Cover |
| ----- |
| {{ playlist_cover_large\|150x150 }} |
→ ![My Favorites\|150x150](https://mosaic.scdn.co/image/abc123)

The Default image size setting (e.g. 200x200) applies to all cover tokens unless overridden inline. See Image dimensions for details.

Track by ID / URL

All track variables are available when using the “Append track by Spotify ID or URL” or “Create file for track by Spotify ID or URL” commands. These commands accept:

  • A full Spotify track URL: https://open.spotify.com/track/4iV5W9uYEdYUVa79Axb7Rh
  • A bare track ID: 4iV5W9uYEdYUVa79Axb7Rh

The same song template (slot 1) is used. {{ timestamp }} reflects the time of insertion, not playback. {{ playlists }} is supported if playlist features are enabled.

Recently Played Variables

Supports all track variables plus:

  • {{ played_at }} - When track was played (YYYY-MM-DD HH:mm)

Examples

Minimal Track Template

'{{ song_name }}' by {{ artists }}
{{ timestamp }}

Detailed Track Template

**Song Name:** {{ song_name }}
**Song URL:** {{ song_link }}
**Album Name:** {{ album }}
**Album Release Date:** {{ album_release }}
**Album URL:** {{ album_link }}
**Cover:** {{ album_cover_medium }}
**Artists:** {{ artists }}
**Genres:** {{ genres_hashtag }}
**Added at:** *{{ timestamp }}*

Track with Playlists

**Song:** {{ song_name }}
**Artists:** {{ artists }}
**Playlists:** {{ playlists }}

Output: **Playlists:** My Favorites, Workout Mix, Chill Vibes

All Playlists Template

---
playlist: "{{ playlist_name }}"
url: "{{ playlist_url }}"
tracks: {{ playlist_track_count }}
public: {{ playlist_public }}
collaborative: {{ playlist_collaborative }}
owner: "{{ playlist_owner }}"
---

## {{ playlist_name }}

{{ playlist_cover_large|300x300 }}

**Link:** {{ playlist_link }}
**Tracks:** {{ playlist_track_count }}
**Owner:** {{ playlist_owner }}
**Public:** {{ playlist_public }} | **Collaborative:** {{ playlist_collaborative }}

> {{ playlist_description }}

---

Minimal All Playlists Template

- {{ playlist_link }} ({{ playlist_track_count }} tracks)

Episode Template

**Episode:** {{ episode_name }}
**Show:** {{ show_name }}
**Publisher:** {{ publisher }}
**Description:** {{ description[200] }}
**Progress:** {{ progress_min_sec }}
**Released:** {{ release_date }}
{{ timestamp }}

Recently Played Template

'{{ song_name }}' by {{ artists }} from {{ album }} @ {{ played_at }}

Dataview Integration

---
track: "{{ song_name }}"
artists: [{{ artists_formatted:":, }}]
album: "{{ album }}"
release: {{ album_release }}
genres: [{{ genres_array }}]
---

# {{ song_name }}

{{ album_cover_medium }}

**Artists:** {{ artists }}
**Genres:** {{ genres_hashtag }}

Template Processing

Variable substitution uses regex replacement:

  1. Load template (file or inline)
  2. Fetch Spotify data
  3. Replace variables with actual values
  4. Handle special cases (formatting, truncation)
  5. Return processed string

Whitespace in variable syntax is optional:

  • {{ song_name }} = {{song_name}}

Advanced Formatting

Conditional Artist Display

Single artist: followers as number
Multiple artists: “Name: count” per artist

Template automatically adapts based on artist count.

Genres — best effort

Spotify assigns genres at the artist and album level, never on the track itself. Album genres have come back empty for years, so {{ album_genres* }} renders _deprecated_ whenever the album carries none — which in practice is almost always.

{{ genres }}, {{ genres_array }}, {{ genres_hashtag }} and {{ genres_by_artist }} are collected from every artist on the track and deduplicated — two artists sharing a genre list it once.

Why your genres are often empty: Spotify only fills this field for artists it has classified. Major-label artists are usually populated; independent artists frequently are not, even when genres were supplied through a distributor. An empty result is Spotify having no data, not a plugin failure. If you need reliable genre data, tag it yourself in the note or source it from MusicBrainz/Last.fm.

Deprecated variables

These render the literal text _deprecated_:

Variable Why
{{ popularity }}, {{ followers }} Spotify removed popularity and followers from the artist object for Development Mode apps in February 2026
{{ track_popularity }} popularity removed from the track object
{{ album_popularity }} popularity removed from the album object
{{ album_genres }}, {{ album_genres_array }}, {{ album_genres_hashtag }} Album genres come back empty for practically every album
{{ audio_preview_url }} Preview URLs are no longer served

The variables are kept so existing templates keep working — removing them would leave raw {{ popularity }} text in your notes. Where Spotify does still return a value (Extended Quota Mode apps), the real value is rendered instead of the marker. Delete these from your templates when convenient; they will be removed in a future release.

Timestamp Formats

Combine date/time components:

{{ timestamp(YYYY-MM-DD HH:mm) }}

UTC variants with z suffix:

{{ timestampz(YYYY-MM-DD HH:mm) }}

Image Size Selection

Spotify provides three sizes (indices 0, 1, 2):

  • [0] - Large (typically 640x640)
  • [1] - Medium (typically 300x300)
  • [2] - Small (typically 64x64)

Image Dimensions

By default Obsidian renders images at full available width. You can constrain the size two ways:

Global default — set Default image size in plugin settings (e.g. 200x200). Applies to every image token unless overridden.

Inline override — append |WxH or |W directly to the token:

{{ album_cover_medium|100x100 }}
{{ album_cover_large|300 }}
{{ artist_image|50x50 }}
{{ episode_cover_medium|150x150 }}

Inline override takes precedence over the setting. The value is passed directly to Obsidian’s image syntax (![alt|WxH](url)), so any value Obsidian accepts works here.

Inside Markdown tables| is the column separator in Markdown, so escape it with \|:

| Cover | Date |
| ----- | ---- |
| {{ album_cover_medium\|100x100 }} | {{ album_release\|YYYY }} |

The plugin detects the \| and preserves it in the generated output (![alt\|WxH](url)), keeping the table structure intact.

Note: the Global default image size setting does not carry the table context — it always outputs a bare |. If you need a sized image inside a table, use the inline \| override explicitly.

Date Formatting

{{ album_release }} (tracks) and {{ release_date }} (episodes) output Spotify’s raw date by default (YYYY-MM-DD, YYYY-MM, or YYYY depending on precision).

Global default — set Default release date format in plugin settings. Tokens: YYYY, MM, DD.

Inline override — append |FORMAT to the token:

{{ album_release|YYYY }}
{{ album_release|YYYY-MM }}
{{ album_release|MM/DD/YYYY }}
{{ release_date|YYYY }}

Inside Markdown tables — use \| instead of |:

{{ album_release\|YYYY }}
{{ release_date\|YYYY-MM }}

Inline override takes precedence over the setting. Leaving both empty preserves the original Spotify date string (fully backward compatible).

Note: date tokens produce plain text output (no | character), so the Global default date format works fine inside tables without any special handling.