Comments (7)
I've generated the page now with the following:
rm -rf public
HUGO_BASEURL="http://localhost:1313/compose/example" hugo -d public/compose/example
And then started serving this with Python:
cd public
python -m http.server -b localhost 1313
I can see from the server logs that the website is asking for icons at the wrong location - at the root, instead of at the baseURL.
127.0.0.1 - - [07/Mar/2022 12:06:18] "GET /compose/example/icons/next.svg HTTP/1.1" 200 -
127.0.0.1 - - [07/Mar/2022 12:06:18] code 404, message File not found
127.0.0.1 - - [07/Mar/2022 12:06:18] "GET /icons/copy.svg HTTP/1.1" 404 -
127.0.0.1 - - [07/Mar/2022 12:06:18] code 404, message File not found
127.0.0.1 - - [07/Mar/2022 12:06:18] "GET /icons/order.svg HTTP/1.1" 404 -
127.0.0.1 - - [07/Mar/2022 12:06:18] code 404, message File not found
127.0.0.1 - - [07/Mar/2022 12:06:18] "GET /icons/carly.svg HTTP/1.1" 404 -
127.0.0.1 - - [07/Mar/2022 12:06:18] code 404, message File not found
127.0.0.1 - - [07/Mar/2022 12:06:18] "GET /icons/expand.svg HTTP/1.1" 404 -
127.0.0.1 - - [07/Mar/2022 12:06:18] code 404, message File not found
127.0.0.1 - - [07/Mar/2022 12:06:18] "GET /icons/copy.svg HTTP/1.1" 404 -
127.0.0.1 - - [07/Mar/2022 12:06:18] code 404, message File not found
127.0.0.1 - - [07/Mar/2022 12:06:18] "GET /icons/order.svg HTTP/1.1" 404 -
127.0.0.1 - - [07/Mar/2022 12:06:18] code 404, message File not found
127.0.0.1 - - [07/Mar/2022 12:06:18] "GET /icons/carly.svg HTTP/1.1" 404 -
127.0.0.1 - - [07/Mar/2022 12:06:18] code 404, message File not found
127.0.0.1 - - [07/Mar/2022 12:06:18] "GET /icons/expand.svg HTTP/1.1" 404 -
127.0.0.1 - - [07/Mar/2022 12:06:18] code 404, message File not found
127.0.0.1 - - [07/Mar/2022 12:06:18] "GET /icons/copy.svg HTTP/1.1" 404 -
127.0.0.1 - - [07/Mar/2022 12:06:18] code 404, message File not found
127.0.0.1 - - [07/Mar/2022 12:06:18] "GET /icons/order.svg HTTP/1.1" 404 -
127.0.0.1 - - [07/Mar/2022 12:06:18] code 404, message File not found
127.0.0.1 - - [07/Mar/2022 12:06:18] "GET /icons/carly.svg HTTP/1.1" 404 -
127.0.0.1 - - [07/Mar/2022 12:06:18] code 404, message File not found
127.0.0.1 - - [07/Mar/2022 12:06:18] "GET /icons/expand.svg HTTP/1.1" 404 -
127.0.0.1 - - [07/Mar/2022 12:06:18] code 404, message File not found
127.0.0.1 - - [07/Mar/2022 12:06:18] "GET /index.json HTTP/1.1" 404 -
from compose.
I think one of the problems is here where we load svgs from the rootURL: https://github.com/onweru/compose/blob/master/assets/js/functions.js#L177
function loadSvg(file, parent, path = iconsPath) {
const link = new URL(`${path}${file}.svg`, rootURL).href;
from compose.
This seems to be the reason why search is not working either:
https://github.com/onweru/compose/blob/master/assets/js/search.js#L196
window.addEventListener('load', function() {
fetch(new URL("index.json", rootURL).href)
https://github.com/onweru/compose/blob/master/assets/js/search.js#L112
if(searchTerm.length) {
window.location.href = new URL(`search/?query=${searchTerm}`, rootURL).href;
from compose.
And rootURL
is defined as: https://github.com/onweru/compose/blob/master/assets/js/variables.js#L7
const rootURL = window.location.protocol + "//" + window.location.host;
from compose.
I've tested an easy fix this works for me in variables.js
// rootURL must end with '/' for relative URLs to work properly
const rootURL = '{{ strings.TrimSuffix "/" .Site.BaseURL }}/';
from compose.
I've created a pull request with my proposal #75
from compose.
Just wanted to add that I have a very easy workaround, I can override the variables.js
in my local site as well for now.
PS: I am new to Hugo, just trying it the first time for documentation and needed a simple theme without dependencies that looks good, that's how I ended up using your theme. Thank you very much for creating this.
from compose.
Related Issues (20)
- Translations from i18n/*.toml aren't respected in variables.js HOT 11
- [FEATURE] Global Search Option HOT 4
- [BUG] Search box is present even when search is disabled
- [BUG] Enter to redirect to search results doesn't work in Firefox HOT 2
- [BUG] Search with global = true still shows "Search in docs" etc. HOT 9
- [FEATURE] - Add Latest Mermaid.js Release HOT 1
- [FEATURE] Google Analytics template included in partial/head.html HOT 3
- [FEATURE] - Light YouTube Embedded HOT 3
- [FEATURE] - Add a Tabbed Group Shortcut HOT 1
- [FEATURE] Add Tina CMS config HOT 1
- [BUG] There are many HTML validation errors
- Idea: After the list of suggestions shows up, allow the user to select an entry with Arrow Up/Down keys and press enter to go to that page HOT 5
- [FEATURE] Gallery short-cut with links
- [BUG] template for shortcode "block" not found HOT 3
- [BUG] blogDir param not working
- [BUG]
- Load icons as sprites via JS
- Modularize search
- [FEATURE] Icons in Nav bar links
- support algolia search
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compose.