Type to search. Arrow keys to move, Enter to open, Esc to close.

All research
Web publishingState as of: 2026-10

Links between sites on separate domains

How one template link stays correct in the local preview and online when sibling sites run on separate domains, and how to check it before uploading.

Research question: How can the same template link be correct in the local preview and online when the sites run on separate domains, and how can it be checked before upload?

Project requirement

Several sites from one source with a shared menu that also links to the sibling sites. With hand-written links, a misspelled domain or mixed http and https only shows up online.

Method and validation

  • One template function, link(domain, path), returns a root-relative link on the same domain and an absolute https link to another domain.
  • Templates build the menu from the configured sites, without hard-coded domains.
  • Local preview: every domain runs on its own port, so links within the same site work locally.
  • A link checker on the built output resolves links to configured domains in the matching local folder, flags http links to the own domains, and checks external links over HTTP on request.
  • pytest for the link function and the checker's exit code; 0 errors on the sample sites, external links included.

Findings

  • A root-relative link always points to the current domain, so navigation within a site works locally and online.
  • An absolute link to a sibling site leads from the local preview to the live site; this is intentional, because templates cannot know the local port.
  • Sibling-site links can still be verified before upload: the checker looks at the local output by domain instead of the network.
  • Because the menu comes from the configuration, adding a site is one configuration entry with no template change.

Decision

One link function in the templates, a menu generated from the configuration, and a link check on the built output that resolves configured domains locally.

Limits and open questions

  • In the local preview a sibling-site link opens the live site; fully local navigation would need a preview URL mapping.
  • The link checker does not run JavaScript, so it does not see links created by scripts.

Sources