Files
hotdog-cms/docs/importing.md
T
jcoffey-dev 0a2e0f33f6
ci / editor-ui (pull_request) Successful in 1m19s
ci / go (pull_request) Successful in 1m30s
Shop: Fourthwall import, sizes and colors, and a cart
hotdog-cms import fourthwall brings a Fourthwall shop's public products
in as shop pack pages, with the storefront token from
HOTDOG_FOURTHWALL_TOKEN: description and details as Markdown, photos
brought into the site, sizes and colors as variants, collections as
terms of a taxonomy. It's run again whenever the shop changes: products
are matched by id, unchanged pages and photos are left alone, front
matter the site added is kept, and products that left the shop are
listed (deleted with -prune).

The shop pack (1.2.0) takes variants: each with a price and a buy link,
or, when the product has a checkout form (Fourthwall's reads the choice
from its address), a size picker whose Buy now goes straight to the
checkout. Both work without a script. Prices that vary show "From", and
search engines get an AggregateOffer.

cart: true in site.yaml turns on a cart: HotDog's cart script, kept in
the visitor's browser and sent nowhere until checkout, which opens the
shop's checkout with every item (id:quantity, joined). Product pages get
Add to cart beside Buy now; the cart page (layout: cart) lists, changes
and removes items and suggests other products, those sharing a tag
first. Themes put {{ cart }} in the head and {{ cartLink }} in the
header, as the starter now does, and the privacy notice says where the
cart is kept.
2026-10-16 15:47:57 -07:00

8.0 KiB

Importing a site

Only import content you own or have the rights to use. The importers are migration tools: they're for moving your own site to HotDog CMS from the tool it's on now. They're not for copying sites, posts or pictures that belong to someone else, and they say so every time they run.

hotdog-cms import brings a site in from WordPress, Hugo, Jekyll, Ghost or MkDocs, or a shop's products from Fourthwall, into a HotDog CMS site made with hotdog-cms new:

hotdog-cms new mysite && cd mysite
hotdog-cms import wordpress -url https://old.example.com
hotdog-cms check
From Command
A live WordPress site import wordpress -url https://example.com (published posts and pages). With -user name and an Application Password in HOTDOG_WP_PASSWORD, drafts and private posts too.
A WordPress export file import wxr -file export.xml (Tools → Export)
Ghost import ghost -file export.json -url https://old.example.com (Settings → Labs → Export)
Hugo import hugo -from ../oldsite (-rename posts=articles by default)
Jekyll import jekyll -from ../oldsite
MkDocs import mkdocs -from ../docs-site (the folder holding mkdocs.yml); see Documentation from MkDocs
A Fourthwall shop import fourthwall with the storefront token in HOTDOG_FOURTHWALL_TOKEN; run it again whenever the shop changes. See A shop from Fourthwall

Every importer takes -site DIR (default .) and -overwrite; the blog importers take -posts COLLECTION (default articles) too.

What happens

  • Markdown where it's faithful. Posts and pages become Markdown files with front matter: title, date, updated, summary, tags (and categories), author, draft, featured image and its alt text.
  • HTML where Markdown would lose something: embeds, layout blocks (page builders, WordPress columns), tables with merged cells, inline styles. Those pages keep their HTML (format: html), and markdown.unsafe_html is turned on so they build. The HTML is sanitized at build time, so scripts and embeds are dropped. The report lists each page and why.
  • Pictures come across, through the same re-encoding as uploads: no location or camera data, resized, WebP copies. A picture that can't be fetched keeps its old address, and the report says so.
  • Old addresses keep working. Every page's old permalink (WordPress links, Hugo url/aliases, Jekyll permalinks and redirect_from, Ghost's /slug/) becomes a redirect to its new address, in site.yaml.
  • Page hierarchies stay: a WordPress page with pages under it becomes its folder's own page, listing its children.
  • What only the old tool could run (WordPress shortcodes like [gallery], Hugo shortcodes, Jekyll's Liquid) is left as text and listed in the report. WordPress's [caption] becomes a figure.
  • Nothing is overwritten unless you say -overwrite. Running an import again skips what's there.

The report goes to IMPORT-REPORT.md in the site. Read it, then run hotdog-cms check and hotdog-cms serve.

Documentation from MkDocs

hotdog-cms new docs && cd docs && rm content/index.md
hotdog-cms import mkdocs -from ../old-docs
hotdog-cms check

A documentation site keeps its addresses, its reading order and the way its pages are written:

  • Pages come across as written. HotDog reads MkDocs' own syntax: admonitions (!!! note, ??? tip), content tabs (=== "Linux"), keys (++ctrl+k++), definition lists, { .class } attributes, Markdown in HTML (markdown on a tag), code blocks' file names (title="…"). A page's first heading becomes its title, and index.md (or README.md) its folder's own page.
  • Addresses stay. The docs go into the docs pack's collection (the pack is added if the site hasn't got it) with path: /, so run/sizing.md is still /run/sizing/. Use -path /docs/ to put them under /docs/ on a site that has its own front page; the front page is why content/index.md has to go with -path /.
  • Links keep landing. Links to other pages' .md files are followed to their addresses at build time, and headings get the anchors MkDocs gives them (markdown.heading_ids: mkdocs), so sizing.md#memory still finds its section. Links to pictures and downloads in the docs are made to work from the page's address. Everything else in docs_dir goes into static/.
  • The nav becomes data/docs-nav.yaml, the docs pack's reading order: sections, a section's index page as its own, links elsewhere. Without a nav, the files' order is used, as MkDocs does.
  • Settings: the site's name, address and description, if site.yaml still has the new site's; pymdownx.keys' key_map (as markdown.keys).

What doesn't come across is listed in IMPORT-REPORT.md, page by page: snippet includes (--8<--), template tags (the macros plugin), abbreviations, icons and emoji (:material-check:), Mermaid diagrams (shown as code), code annotations, and the theme's overrides and extra CSS and JavaScript: the site's own look replaces the theme. Code blocks are colored as pymdownx.highlight colors them, with the same class names, and hl_lines marks lines; line numbers (linenums) aren't drawn.

MkDocs passes any HTML in a page through as it is; HotDog sanitizes it, so an inline <svg>, a <script> or a style="" is removed, and the report lists each. If everyone who writes the docs can be trusted with scripts, -trust-html turns the sanitizer off for the site (markdown.trust_html).

A shop from Fourthwall

hotdog-cms new shop && cd shop
export HOTDOG_FOURTHWALL_TOKEN=ptkn_…
hotdog-cms import fourthwall -taxonomy tags
hotdog-cms check

Fourthwall makes things to order and sells them: its shop takes the payment, the address and any tax, and sends the order. A HotDog site can be the shop window, with Fourthwall's checkout behind it. The token is the shop's storefront token (Settings → For Developers → Storefront API): it can only read the catalog, which is public anyway.

  • Every public product becomes a page for the shop pack (added if the site hasn't got it), in content/products/: the name, a summary from the description's first paragraph, the description and Fourthwall's details (fit, care, returns) as Markdown, the price ("From" when sizes cost more), and Fourthwall's order, as weight.
  • Photos are brought into the site, at most six a product (-photos), so visitors load nothing from Fourthwall until they check out. Photos on a transparent background stay WebP, with their transparency.
  • Sizes and colors become variants, each straight to Fourthwall's checkout, so Buy now needs no script and no cart. With cart: true in site.yaml, Add to cart sits beside it (the shop pack's notes say how).
  • Collections become terms of the taxonomy -taxonomy names (tags, or one of your own in site.yaml), so a shop's Hats are under /tags/hats/.
  • Run it again whenever the shop changes. Products are matched by Fourthwall's id, so a renamed product keeps its page; photos already brought in aren't fetched again; pages that haven't changed aren't written. Fourthwall stays the source: edit products there. Front matter the site adds itself (featured: true, say) is kept. A product that has left the shop is listed, and deleted with -prune. Pages that didn't come from Fourthwall are never touched.
  • Checkout is the shop's own address, from Fourthwall. If the shop has a domain of its own for checkout, give it with -checkout https://checkout.example.com.

Fourthwall serves only public products, while a shop behind its password page still sells through its checkout: a way to try the whole site before opening.

The WordPress password

Use an Application Password (Users → Profile → Application Passwords), not the login password. It's read from HOTDOG_WP_PASSWORD, used for the requests, and never written anywhere. Revoke it in WordPress when the import is done.