You’re reading the ZotLit v2 docs. Still on v1? Read the v1 docs

ZotLit

How to customize a template

Edit a literature note profile, the citation text, or a shared partial in the Template Workbench View, and preview the result.

Use the Template Workbench View to change a literature note's name, folder, properties, body, or annotation format, to change the text a citation inserts, or to share a piece of template text between profiles.

A profile is the document that authors one literature note. See Profiles for what a profile holds and how ZotLit chooses one. If your vault still holds 2.1 template files, Migrate from 2.1 templates folds them into profile documents first.

Edit a literature note profile

Open the profile

In Obsidian, open Settings > ZotLit. On the Templates and properties row, select its pencil button, tooltipped Edit profile.

Customizing the built-in Default creates its document in the configured template folder before editing becomes available. If a custom document already exists, ZotLit opens it. If creation fails, use the retry action beside the error.

To edit the profile used by an existing literature note, open that note and run ZotLit: Customize this note's template. The same action is in the note's file menu. ZotLit opens the Template Workbench View with that note's item selected.

From a compact Template Workbench View, open its pane menu and select Open template workbench. This opens the editor, Data Explorer, and preview together in a separate Obsidian window.

Choose preview data

If no item is selected, choose one in Data Explorer or select Choose item. You can try a built-in journal article, conference paper, book, or thesis example.

Choose a library item under Recent, or select Search Zotero… to search your Zotero library. Selecting an item replaces the Explorer's list with its fields.

For annotation formatting, select Choose annotation. Search annotations from the selected item or try a highlight, underline, note, text, image, or ink example. Annotation examples keep their own parent item data; the note preview keeps its selected item.

Choosing data in any linked pane updates the other linked panes. Separate workbenches keep their own selections. Full panels have selection actions in the header; sidebars have a small selection control. Right-click the pane header to access its menu in either layout.

Data used for the preview updates automatically. To load it again, select Reload preview data from the pane menu. In On demand mode, select Run to render the preview.

Edit and preview

Use the Note, Properties, Annotation, Match, and Name and folder tabs to edit the profile. The Default profile does not use Match conditions.

Check the Note preview as you edit. Source is a toggle: select it to edit the complete profile document as Markdown, and select it again to return to the tabs.

On the Name and folder tab, the Note path group holds the Literature note folder, the Note name template, and a Preview of the full path the note gets, with .md. A slash (/) in the note name makes a subfolder in the folder. For the Default profile, change the folder in Settings > ZotLit. The Match tab reports Matches selected item or Does not match selected item for the selected item.

If the preview fails, retry or choose another item. You can continue editing the profile.

Apply the changes

The Template Workbench View uses Obsidian's automatic saving for edits, Undo, and Redo. A profile with an error remains editable and saves with its diagnostics shown in the editor.

Existing notes keep their content until you update them. Open a literature note and run ZotLit: Update literature note to apply its profile.

The Template Workbench View supports Liquid, Eta, and JavaScript frontmatter fields. Eta and JavaScript fields require the JavaScript templates gate.

To return this template to its built-in form, select Restore built-in on the same row. ZotLit moves the file to Obsidian's configured trash. You can recover it from there; existing notes keep their content until updated.

Customize the citation text

The citation text is one template document, zotlit-citation.md, that renders every citation you insert. It renders both the main and the alternate citation from one source: zt.variant tells it which gesture asked for the citation.

Open the citation text

Open Settings > ZotLit > Citations. Find the Citation text row and select its pencil button, tooltipped Open citation text.

The row's second line shows the document's vault path, or Using the built-in default. while your vault holds no file. With no file, that button writes zotlit-citation.md from the built-in text first, then opens it.

Two other entry points open the same document: the command ZotLit: Customize citation text, and Open citation text in the Template Workbench View's pane menu.

Edit the source

The document opens in the Template Workbench View on one Citation tab. That tab is the source of the whole document, and the view offers no Source toggle for it: the tab already shows everything the document holds. A caption above the editor names the document's language.

The template receives zt.variant, zt.citations, and zt.items. See Citation templates for the fields on each cited item.

Check the preview

Citation preview renders what you have typed, including bytes you have not saved.

Its pane menu offers Use example with six built-in citation shapes: One item, Two items, Item with page, Suppressed author, Prefix and suffix, and Annotation citation. It opens on One item.

Select Choose item instead to preview one of your own Zotero items, by citation key alone. That clears the example.

Switch between Preview main citation and Preview alternate citation from the same menu to check both branches of your template. The preview caption names the variant on show.

Edits take effect on the next citation you insert. Existing citations in your notes are plain text and stay as written.

Restore the built-in citation text

Once the document exists, the Citation text row also carries a rotate button, tooltipped Reset to default. It asks Reset citation text? and then moves your document to Obsidian's configured trash, where you can recover it. New citations use the built-in text again.

Share a piece of template text between profiles

A partial is a template document that any other template renders by name. Write a line once, in zotlit-partial.<name>.md, and call it from every profile and from the citation text.

Create a partial

Three ways, all of which name the file for you:

  • Open Settings > ZotLit > Literature note profiles > Partials and select Add partial.
  • Type {% render " or {% include " in a Liquid template, or include(" in an Eta one. The completion lists every partial in your vault and ends with New partial…. The new document opens in a split beside what you were editing.
  • Select some template text, right-click it, and choose Extract to partial…. ZotLit moves the selection into the new document, leaves the matching call behind, and opens the new document in a split. In the template you extracted from, that is one undo step.

Name a partial with letters, digits, and hyphens. ZotLit trims the name, turns each run of spaces into a hyphen, and lowercases it, so Journal line becomes journal-line. Names are one flat list for your whole vault, and two partials cannot share a name regardless of case.

Five names belong to other ZotLit templates and are refused: filename, note, annotation, content, and citation. A file that takes one anyway registers nothing and gets a Reserved partial name row in settings.

Call a partial

In Liquid:

{% render "authors" with zt as zt %}

In Eta:

<%~ include("authors", zt) %>

In Liquid, the with zt as zt clause is not optional. The render tag opens an isolated scope, so a bare {% render "authors" %} cannot see the caller's zt: every zt output in the partial comes out empty, and only its literal text survives. Accepting a name from the completion list writes the clause for you.

Liquid's {% include %} tag renders a partial with access to the caller's variables, and needs no with clause. Use render when you want the partial's scope kept separate. See Calling a partial for the complete rule, and the Eta form for an Eta document.

Preview and edit a partial

In a profile's tabs, with Source off, a call with a plain quoted name (Liquid render or include, Eta include(...)) is drawn as a Partial Placeholder: a compact control carrying the partial's name, the rest of the arguments as written, Preview partial, and Edit partial. The preview arrow opens a read-only render of that partial below the line, using the data of the slice the call sits in. Put your cursor in the call and the placeholder turns back into plain source, so you can edit the arguments.

The five reserved names are never partial names, so none of them draws one: {% render "annotation" %} draws the annotation placeholder for the profile's annotation section, and a call on filename, note, content, or citation draws nothing. A call inside a fenced code block is prose about a call, and draws nothing either.

A partial has no data of its own, so its own editor asks you which caller to render as: Preview as called from Note, Preview as called from Annotation, or Preview as called from Citation, from the preview pane menu. It opens on Note and remembers your choice for that file.

Rename or delete a partial

Renaming is an ordinary Obsidian file rename. ZotLit has no rename action and rewrites no calls, so every template that called the old name then marks its placeholder Missing. Select that marker to read the problem in the editor's Problems area, then edit the call or create the partial yourself.

To delete, open the partial's row at Settings > ZotLit > Literature note profiles > Partials, open its More actions menu, and select Delete partial. ZotLit moves the file to Obsidian's configured trash and rewrites no callers.

A note that ZotLit writes through a template calling a partial your vault no longer holds is not written at all. ZotLit says which partial is missing and offers Open template workbench to open the document holding the failing call.

See also

Last updated on

On this page