Subfolders for products
sbliven opened this issue · comments
I'm trying to set up pages with a subpath (e.g. permalink: /product1/overview.html
). However, I'm getting lots of errors with the default layouts, which seem to include all the static assets with relative paths, e.g.
[2019-06-14 08:43:09] ERROR `/product1/js/toc.js' not found.
For instance, in _includes/head.html
we have
<script src="{{ "js/toc.js" }}"></script>
I'm not a Liquid expert, so it's probable I'm either unfamiliar with the {{ "filename" }}
syntax, or maybe I'm using the wrong jekyll version. However, this seems to just print the string "js/toc.js" directly rather than dereferencing the file and figuring out the full path. Instead, isn't the correct way to reference static files like this:
<script src="{{ site.baseurl }}/js/toc.js"></script>
I'm not sure if this is a bug in the theme or a mistake in how I'm using the theme.
Versions:
ruby 2.5.3
jekyll 3.8.5
github-pages 198
Or maybe this is more idiomatic:
<script src="{{ "/js/toc.js" | relative_path }}"></script>
There are a lot of places which assume all pages are top-level. For instance, sidebar, topnav, etc strip slashes from paths (using | remove: "/"
) which completely breaks absolute paths. I'm not sure why those remove statements were necessary–maybe it was a workaround to support baseurl
? If so then the relative_path
filter is clearer and more consistent.
Did you find a solution to this problem?