Base element

Standard HTML has a base element that is prepended to all relative URLs and can be used to serve your site from a subfolder (e.g., which is common on platforms like GitLab Pages.


In your sitewide plenti.json configuration file, you can specify a baseurl like this:

  "baseurl": "/my-subfolder/"

The local webserver (plenti servewill serve the root of your site from that subfolder: http://localhost:3000/my-subfolder/.

The baseurl information gets added to a magic variable called env that you can add to the <head> element like this:

  export let env;

  <base href="{env.baseurl}">

(Note: make sure to first pass env from the parent component, likely layouts/global/html.svelte)


Now that your site is configured to use baseurls, you need to make sure you're actually using relative links (about), not root relative links (/about) or absolute links ( You'll also want to update all links back to your homepage to use a dot . instead of a forward slash /in order to work with the base element correctly when deployed.