Can I define a dedicated/default Template folder?

Can I create a default (dedicated) template folder, where I put my template(s) and then only #import using the filename without the complete path?

1 Like

You can store your templates in a local package namespace. For this, you need to put your template package in a specific directory, depending on your operating system:

  • Windows: %APPDATA%\typst\packages\<namespace>\<name>\<version>
  • macOS: ~/Library/Application Support/typst/packages/<namespace>/<name>/<version>
  • Linux: ~/.local/share/typst/packages/<namespace>/<name>/<version> (or via the environment variable $XDG_DATA_HOME, see the above link)

For <namespace>, you can use whatever you want, but something like local or templates would probably be a sensible choice. Additionally, all your templates need a name and a version. You can then import a template from your Typst document via

#import "@<namespace>/<name>:<version>": *
4 Likes

Taht is exactly what I was looking for. Thank You

Just because I first ran into this issue, here is something to be aware for everyone:

<version> is the folder, where the full package has to be. It has to contain not only the template.typ but also a typst.toml with the metadate. For more details, read the Header Package format in the link @Eric’s answer.