# Trailhead: moving from Zola

Zola is a single Rust binary, and SiteSquatch runs on Node (from npm), so the move is mostly about templates: Tera becomes Nunjucks or Jinja (which read almost the same), and `config.toml` becomes `ssqch.config.js`. Your content can stay as it is: SiteSquatch reads TOML front matter between `+++` lines.

A real-world blog was ported this way as a trial: all of its URLs and most pages came out the same. The [`blog-tags`](https://github.com/reverentgeek/sitesquatch/tree/main/examples/sites/blog-tags/) example is a small blog laid out like a Zola site (sections, tags with feeds, aliases, highlighting), inspired by a real-world blog.

## Scouting

`ssqch scout` (see [Scouting a site](https://sitesquatch.dev/docs/trailheads/index.md#scouting-a-site)) lists what this guide describes for your site and drafts the mechanical part. Its edits, in each page's `+++` front matter, move `tags` out of `[taxonomies]` to the top level and turn `path` into a `permalink`. Its draft is a first `ssqch.config.js` from `config.toml`: `content/` as the input and `templates/` for layouts, `config.title` and `config.extra` as data so templates keep reading them, the Markdown options, Sass, a sitemap, redirects for `aliases`, and `static/` copied as it is. Then it lists what's left with where it is: each section (`_index.md`), each shortcode used in the content, and counts of the Tera constructs in your templates that read differently in Jinja. It changes nothing on its own: `--write-draft` writes the draft and `--patch move.patch` the edits, to read and `git apply`.

A whole move with the loop, scout's report before, halfway and at the end, with `baseline` and `diff` between: [A move, step by step](https://sitesquatch.dev/docs/agents/index.md#a-move-step-by-step).

## The config

| Zola (`config.toml`) | SiteSquatch (`ssqch.config.js`) |
| --- | --- |
| `base_url` | Data: `data: { site: { url: "https://example.com" } }`, then `{{ site.url }}`. For a site under a path, `base: "/repo/"`. |
| `title`, `description`, `[extra]` | The same `site` data, or `_data/site.toml` (TOML data files work) |
| `highlight_code = true`, `highlight_theme` | `markdown: { highlight: true }`. Colors come from `/highlight.css` and its `--hl-*` properties instead of a theme name. |
| `extra_syntaxes_and_themes` (Zola 0.21) | Your `.sublime-syntax` files load as they are ([Your own highlighter, step by step](https://sitesquatch.dev/docs/markdown/index.md#your-own-highlighter-step-by-step) has when to use one), one entry for each file rather than a folder, by its path from the project root: `markdown: { highlight: { languages: { trail: "syntaxes/trail.sublime-syntax" } } }`. Fences named by that key, or by one of the grammar's `file_extensions`, are highlighted. Themes (`.tmTheme`) don't load: set the `--hl-*` properties of `/highlight.css` |
| `extra_grammars`, `extra_themes` (Zola 0.22) | TextMate JSON grammars and themes don't load. For a grammar, use a `.sublime-syntax` file of the language, or a highlighter of your own ([Your own highlighter, step by step](https://sitesquatch.dev/docs/markdown/index.md#your-own-highlighter-step-by-step)) |
| `generate_feeds = true` | `feedPlugin({ url })` from `ssqch/rss` (Atom, or `format: "rss"`), or `rssPlugin()` and a feed template of your own (see `blog-tags/src/feed.njk`) |
| `taxonomies = [{ name = "tags", feed = true }]` | Tags are built in: `tags: [...]` in front matter, `collections.<tag>` in templates. Tag pages and per-tag feeds are a template paginated over the tag list. |
| Automatic `sitemap.xml` | `sitemapPlugin({ url })` from `ssqch/sitemap` |
| `insert_anchor_links` | A heading render hook: `_includes/hooks/heading.njk` |
| `slugify` settings (Zola's default anchors) | `markdown: { headingIds: "ascii" }`, which transliterates the same way (`🦀` is `crab`) |
| `compile_sass` | `sassPlugin({ files: { "sass": "/" } })` from `ssqch/sass` |
| `build_search_index` | Not built in; Pagefind after the build |
| `zola check` | `linksPlugin()` checks internal links and anchors on every build. External links aren't checked. |

## Content

| Zola | SiteSquatch |
| --- | --- |
| `content/blog/_index.md` (a section) | A folder with directory data, `blog/blog.json` (layout, tags, permalink), and an `index` page that lists its posts |
| `content/blog/post/index.md` with images (a page bundle) | The same, with `pageBundles: true` in the config (`bundles: true` before 0.17) |
| `+++` TOML front matter | Works as is |
| `title`, `date`, `description` | The same names |
| `draft = true` | The same: built by `ssqch serve`, left out of `ssqch build` |
| `aliases = ["2019/05/15/post.html"]` | The same, with `redirectsPlugin()` from `ssqch/redirects`. Without a leading `/`, an alias is still from the site's root, and old URLs keep their `#fragment`. |
| `slug`, `path` | `permalink`, which can use data: `permalink: "/blog/{{ page.date \| datePath }}/{{ page.fileSlug }}/"` |
| `weight` | Any field; sort by it in a custom collection |
| `[taxonomies]` `tags = [...]` | `tags = [...]` at the top level of the front matter |
| `[extra]` fields | Stay where they are: `{{ extra.subtitle }}` |
| No `date`, with the date in `path` | `computed: { date: (data) => ... }` in a directory data file (`content/content.data.js`); a computed date is the page's date |
| A page with no date of its own | Its file's time in ssqch, which a checkout or a save moves: dates and the order of lists change from one build to the next, and on each save `ssqch serve` renders the pages that show it (every page that reads collections, when the site's code sorts by dates). `dateFallback: "git"` gives it its last commit's date (`ssqch scout` counts the pages that have none) |
| `_index.md` section front matter | A data file (`_data/sections.json`), and `ignore: ["**/_index.md"]` |
| `<!-- more -->` summaries | The same: `page.excerpt` is the HTML before it |
| Internal links (`@/blog/post.md`) | URL paths (`/blog/2024/01/15/post/`); the link checker catches mistakes |
| Footnotes | Built in |

## Templates

Use `.jinja` files, ssqch's default, so Markdown already runs through Jinja and shortcode calls in it keep working as macros. (`.njk` works too, with `markdownEngine: "njk"`.)

| Tera | Nunjucks in SiteSquatch |
| --- | --- |
| `{% extends "base.html" %}`, `{% block %}` | The same. Layouts can also use `layout:` front matter with `{{ content \| safe }}`. |
| `{{ page.title }}`, `{{ page.content \| safe }}` | `{{ title }}`, `{{ content \| safe }}`: a page's data is at the top level |
| `{{ section.pages }}` | `collections.<name>`: a tag, or a custom collection from `collections` in the config |
| `{{ get_url(path="...") }}` | The plain path |
| `get_page(path="...")` | Look the page up in a collection |
| `{{ page.date \| date(format="%Y") }}` | A config filter: `filters: { year: d => d.getUTCFullYear() }` |
| `{{ page.toc }}` | `{{ toc(page.headings) \| safe }}`, in the layout |
| `{{ page.reading_time }}` | `{{ readingTime(content) }}` |
| Macros (`{% import "macros.html" as m %}`) | The same; add `with context` if the macro reads page data or collections |
| Shortcodes (`{{ youtube(id="x") }}`) | Macros in an include, imported where they're used, or a config filter |
| Body shortcodes (`{% note() %}...{% end %}`) | Containers: `::: note` renders `_includes/containers/note.njk` with the body as `container.content` |

Config filters are JavaScript functions with positional arguments: Tera's `date(format="%Y")` becomes `date("%Y")`.

## What's missing

A search index, translations and external link checking aren't built in; search works with Pagefind after the build (`afterBuild: { run: "npx -y pagefind --site dist" }`). Sass is `sassPlugin()` from `ssqch/sass`, and Zola's footnote markup can be kept with the `footnote-ref` and `footnotes` render hooks.

To check the move, build with Zola and with ssqch and run `ssqch diff public dist`: it lists the pages that differ and how.

A file whose changes are all dates or years says `only dates changed (2025 -> 2026)`, and the end of the report counts them (`All 12 changed files differ only in dates or years`). The usual cause is a page with no `date` of its own (the [Content](#content) table), dated by its file's time: give it a `date` or set `dateFallback: "git"`, and write a copyright year as `{{ now() | dateformat("%Y") }}`.
