Home

Awesome

If this plugin helps you, I'd really appreciate your support. You can buy me a coffee here.

SmartBlocks for Logseq

GitHub all releases version

This plugin enables advanced templating workflows within logseq.

Currently porting features from the official Smartblocks from Roam plugin. Feel free to ping me on twitter @aryansawhney17, or file a github issue for any feedback or feature requests.

Features

Template Inserter

Setup

  1. Use the slash menu and type Create smartblock button block
  2. Update the values through the input

Usage in action

Screen Recording 2022-01-16 at 5 19 50 PM Screen Recording 2022-01-30 at 12 48 51 AM Screen Recording 2022-03-31 at 10 54 10 AM

Expand from smartblock expander

Types of expansion

Flags

Accessing page properties

Encode URL method

  1. A useful application for SmartBlocks is automatically generating URLs or iFrame embeds based on things like the page name
  2. In this case it becomes useful to format variables into page names.
  3. Hence, by simply adding a second % you can have it encoded into URL format.
    • <%%currentPage%>

Using NLP

  1. In the templates, wherever you want a dynamic date, one that shows a different value based on the date it was inserted, use this syntax <%NLP Input%>
    • <%Today%>
    • <%Last monday%>
    • <%current time%>
    • <%30th of december%>
  2. Automatically respects your date settings
    • Your format will automatically generate a specific date
  3. Support Aliases
    • [tomorrow](<%tomorrow%>) in the template generates [tomorrow]([[Jan 19th, 2022]]) Screen Recording 2022-01-18 at 12 36 29 PM

Using if statements with dates

  1. If you want an item in a template to only show up on a certain day of the week
  2. Follow the below syntax
    • if the day of the week is monday
      • <%if dayofweek = 1: text to be entered%>
    • if it's the 22th
      • <%if dayofmonth = 22: text to be entered%>
    • if it's the 100th day of the year
      • <%if dayofyear = 100: text to be entered%>
    • if it's July
      • <%month%> = 7: text to be entered
  3. As of the latest release, you can now have OR statements to result in insertion if any of the properties are in action. Simply separate the parameters with ||. Some examples are as follows
    • if it's either january or a monday
      • <%if month = 1|| if dayofweek = 1 : text to be entered%>
    • if it's a weekend
      • <%if dayofweek = 6|| if dayofweek = 7 : text to be entered%>

Using the Random Function

Call renderers using randUUID

Set inputs and use variables

Using the weather function

Using the current Page functoin

Limitations

TODO

Using variables and inputs

Screen Recording 2022-02-08 at 11 58 41 AM

Property Renderer

Has been shifted to it's own plugin: https://github.com/sawhney17/logseq-property-visualizer

Credits

If you like the work I'm doing, consider buying me a coffee :)