plentico / plenti

Static Site Generator with Go backend and Svelte frontend
https://plenti.co
Apache License 2.0
985 stars 50 forks source link

Assets dir in Plenti site template #286

Closed jamestagal closed 11 months ago

jamestagal commented 11 months ago

Hi @jimafisk

Just started on a new theme and noticed that in the head.svelte file the logo.svg points to the assets not the newer media directory. See below.

Also not sure whether the first back slash is needed as well but that might only be the case when using a baseurl setup?

See below.

<script>
  export let title;
</script>

<head>
  <meta charset='utf-8'>
  <meta name='viewport' content='width=device-width,initial-scale=1'>

  <title>{ title }</title>

  <script type="module" src="/spa/core/main.js"></script>

  <link rel="icon" type="image/svg+xml" href="/assets/logo.svg">
  <link rel='stylesheet' href='/spa/bundle.css'>
</head>

Cheers, Ben

jimafisk commented 11 months ago

Oh good catch @jamestagal! Looks like the bare starter was still referencing the old assets folder instead of the new media folder. I just fixed this, so it should be available in the next release!

You're exactly right about the baseurl. If you're using baseurl, removing the forward slash from static references lets you serve the entire site from a subfolder. If you're not using baseurl, you can just use an absolute or root relative reference with a forward slash. It's more confusing than I'd like, but unfortunately that's how HTML handles baseurls and root relative paths: https://stackoverflow.com/questions/11521011/why-base-tag-does-not-work-for-relative-paths

jimafisk commented 11 months ago

Should be all set in v0.6.21

Thanks for flagging this to me @jamestagal!

jamestagal commented 11 months ago

Thanks @jimafisk and thank you for adding an entry into the docs for baseurl. That information really helps. Cheers, Ben