Custom Template

Custom templates are available from version 1.2.4 onwards. This feature requires a Pro license - upgrade here.

What are Custom Templates in Send to Logseq?

Custom templates let you control how your captured content is formatted when saved to Logseq. With templates, you can:

  • Create consistent formats for different types of content (articles, links, images, etc.)
  • Automatically include metadata like dates, URLs, and tags
  • Maintain uniform organization across your captures

What types of templates are available?

Send to Logseq offers four template types:

  • captureArticle - For saving entire web page
  • captureSelection - For saving selected text
  • captureLink - For saving links
  • captureImage - For saving images or screenshots

What variables can I use in templates?

You can use these variables in your templates:

Variable Description Example
{{site}} The website domain https://logseq-clipper.dytes.cc
{{pageUrl}} The full URL of the page https://logseq-clipper.dytes.cc/custom-template
{{title}} The page title Send to Logseq: Web Clipper for Logseq
{{content}} The captured text or article content Your selection text here
{{url}} URL of the specific captured element (link or image) https://example.com/image.jpg
{{imageSize}} The size of the image as displayed on the webpage {:width 600}
{{date}} Current date in your preferred format 2024-11-09
{{time}} Current time 12:30
{{year}} Current year 2024
{{yearMonth}} Current year and month 2024-11

How do I write a template?

Templates use simple mustache-style syntax. Here’s an example for capturing an article:

{{#captureArticle}}
  [{{title}}]({{pageUrl}})
    URL:: {{pageUrl}}
    Site:: [[{{site}}]]
    Date:: [[{{date}}]]
    Time:: {{time}}
    Tags:: #Inbox
    {{content}}
{{/captureArticle}}

This template will create a block with a link to the page and related properties. The page content will be captured as child blocks.

When capturing an article as a standalone Logseq page, use this format:

{{#captureArticle}}
  URL:: {{pageUrl}}
  Site:: [[{{site}}]]
  Date:: [[{{date}}]]
  Time:: {{time}}
  Tags:: #Inbox
  {{content}}
{{/captureArticle}}

The page title will be used to create a new Logseq page, and the above configured URL, Site, Date, Time, and Tags will be added as page properties.

What’s more, if you prefer to capture article as a page, and annotate it within the page, you can use the following format:

{{#captureArticle}}
  URL:: {{pageUrl}}
  Site:: [[{{site}}]]
  Date:: [[{{date}}]]
  Time:: {{time}}
  Tags:: #Inbox

  # Summary
    Add your summary here

  # Content
    {{content}}
{{/captureArticle}}

A H1 summary block will be created automatically, and page content will be captured as child blocks of the H1 Content block.

Important template syntax:

  • Start a template section with {{#templateName}}
  • End a template section with {{/templateName}}
  • Insert variables using {{variableName}}
  • Create Logseq page references with [[{{variableName}}]]
  • Use 2-space indentation for nested blocks

Creating nested blocks

You can create nested blocks in Logseq by using indentation in your templates:

{{#captureSelection}}
  {{#todo}} TODO {{/todo}} {{content}}
    Here is my nested content
      This text was selected from {{pageUrl}}
{{/captureSelection}}

Adding TODOs to captures

Add TODO markers using the {{#todo}} helper:

{{#captureSelection}}
  {{#todo}} TODO {{/todo}} {{content}}
{{/captureSelection}}

Date formatting in templates

Date formatting follows your Logseq settings:

  • The {{date}} variable automatically formatted per your preferred format in Logseq settings
  • Use {{yearMonth}} for monthly pages (outputs in format like 2024-11)

Resetting templates

To restore default templates, either:

  • Click the Reset to Default button in extension settings
  • Leave the template field empty

Default templates

{{#captureArticle}}
  [{{title}}]({{pageUrl}})
    URL:: {{pageUrl}}
    Date:: [[{{date}}]]

    {{content}}

{{/captureArticle}}

{{#captureLink}}
  {{#todo}} TODO {{/todo}} [{{content}}]({{url}})
{{/captureLink}}

{{#captureSelection}}
  {{#todo}} TODO {{/todo}} {{content}}
{{/captureSelection}}

{{#captureImage}}
  ![{{title}}]({{url}}){{imageSize}}
  URL:: {{pageUrl}}
  Date:: [[{{date}}]]
{{/captureImage}}

Feel free to contact us if you have any questions or feedback at [email protected] or X @dytes_studio