Comments (14)
Ok, I didn't know that this is a common use case.
multiple sites into one domain
If that's the way commonly used(use sub-path), we have to consider it.
I'll dig into this issue more.
from hugo-theme-zzo.
How about set BaseURL = ""
I think to include some path to the baseURL is not seems to be supported in the Hugo(I'm not sure).
Is there any reason that you include /blog/ to the baseURL?
I did some quick search for this. See this issue
from hugo-theme-zzo.
HI
For the moment I have the old blog which is still active at the root, that's why I use the / blog /
But even after I would like to keep the blog file
the url base is normally provided by hugo :
https://gohugo.io/getting-started/quick-start/#site-configuration
from hugo-theme-zzo.
I think this issue will be fixed easily if you are not using a suffix path like /blog/. And set BaseURL = ""
Do you want to use the /blog/ suffix anyway?
from hugo-theme-zzo.
Yes I prefer to keep the blog folder
In fact this notation works : ![Example image](/blog/images/whoami/avatar.jpg)
from hugo-theme-zzo.
In the case that you want to use /blog suffix, you need to do some customize by overriding some file in the zzo theme’s partial folder. If you hit the ctrl + shift + i keys on the browser, you can see some error message. You have to fix this error otherwise, search will not work.
I will do some test on it and tell you how to do this
from hugo-theme-zzo.
Thanks for your help
even without the suffix i have an error
GET http://localhost:1313/webmanifest.webmanifest 404 (Not Found)
from hugo-theme-zzo.
Yes, I fixed this error yesterday. In that particular error, you should delete home.webmanifest file in root/themes/zzo/layouts and we are good to go.
If you are not much modified the zzo folder, I recommend you to reinstall zzo folder
from hugo-theme-zzo.
@Lemania Hey friend~
My hosting service even not support any suffixes in the baseURL path. So, I simulated how to solve the problem in my head. try this.
[GET https://circlotron.audio/index.json 404 (Not Found)]
This error occurred because the index.json file can be found at https://circlotron.audio/blog/index.json. this index.json file is used for the site search. You can fix this error by overriding the file at root/themes/zzo/layouts/partials/head/scripts.html. Make a file at root/layouts/partials/head/scripts.html and copy the theme's file code to your file. And then, edit the below part.
...
function initFuse() {
if (!endsWith(baseurl, "/")) {
baseurl = baseurl + '/';
};
$.ajax({
type: "GET",
url: baseurl + "index.json",
contentType: "application/json; charset=utf-8",
dataType: "json",
})
...
You can see that url: baseurl + "index.json"
. You should fix this part. Try something like this.
- url: baseurl + "blog/index.json"
[GET https://circlotron.audio/blog/webmanifest.webmanifest 404 (Not Found)]
As I suggested above, you would better to reinstall the Zzo theme first, I already deleted the home.webmanifest file in the new version of the Zzo theme and made some bug fixed.
If you want to add a manifest file at your site, add a manifest.json file to your root/static folder.
As for the img shortcode
In the OP, you are using the img shortcode provided by the Zzo theme something like this
{{< img src="/whoami/avatar.jpg" >}}
In case that the path is not correct on your end, you should override this shortcode file. Copy-paste the file at root/themes/zzo/layouts/shortcodes/img.html to yours at root/layouts/shortcodes/img.html. You may want to edit this part
...
<img data-src="/blog{{ .Get "src" }}" ...
...
from hugo-theme-zzo.
I guess the feature of "adding base url prefix to static files" should be important when deploying multiple sites into one domain, where one site is deployed to "/" and others are deployed to "/sub-dir/". I got the same confusion recently, and my current workaround is hardcode every 'sub-dir' name in every image path in content posts. Looking forward to this issue be solved. Thanks!
from hugo-theme-zzo.
@yanlinlin82
I added a prefix to the search and image shortcode.
But I tested it only in my local environment.
Actually, I failed to host a site with sub-path😭
So can you let me know if it works fine after the update?
from hugo-theme-zzo.
I am so sorry that I just noticed this is not under 'gohugoio/hugo' project, but a theme of hugo. I guess this should be issue of 'gohugoio/hugo', (because I met the same problem in my theme, ) and I should be redirected here from some of its issues yesterday.
Here go my steps to reproduce the problem:
- create a temp test dir, and go into it:
mkdir hugo-test cd hugo-test
- clone you repo:
git clone https://github.com/zzossig/hugo-theme-zzo zzo
- go into example dir:
cd zzo/exampleSite/
- change the config (add sub-dir
foo
):sed -i 's,^\(baseURL.*\)"$,\1/foo",' config/_default/config.toml
- add a new post (with an image "/images/test.img"):
cat<<EOF>content/posts/foo.md --- title: Foo date: 2020-01-03T09:43:05+08:00 --- This is a test. ![](/images/test.img) After the image. EOF
- start hugo server
hugo server --themesDir ../..
- browse the new page (with the title "Foo", the url should be http://localhost:1313/foo/en/posts/foo/) and check the source of the image part.
Here, the image
<article class="single__contents"> <p>This is a test.<br> <img src="/images/test.img" alt="" style="cursor: pointer;"><br> After the image.</p> </article>
src
attribute is "/images/test.img", but not "/foo/images/test.img".
from hugo-theme-zzo.
Hmm Ok, anyway.
@Lemania Hello, are you still get in trouble?
I updated regarding baseURL and you may don't need to do the things that I mentioned above.
from hugo-theme-zzo.
I'm closing this issue now since inactivity.
Feel free to reopen or make a new issue.
I'll do my best.
from hugo-theme-zzo.
Related Issues (20)
- parse failed: template: _default/single.html:55: undefined variable "$enableToc"
- Deploy to Github page in subdirectory not work HOT 3
- found no layout file for "searchindex" for kind "page" HOT 2
- Replace `markdownify` with `.Page.RenderString`
- Typo at 'Getting Started' HOT 1
- Ability to define file name in code listing snippet
- Language dependent values in params.toml HOT 1
- favicon HOT 1
- How to modify the landing page? HOT 1
- Utterance comments does not work HOT 1
- Contact form netlify HOT 2
- SEO crucial issue with title HOT 1
- [Question] Change props of a specific theme
- Adapt zzo theme to SEO best practices
- Website title taken from languages.toml instead of config.toml
- Unable to change font color on slides
- Solution for a mobile icon for languages:
- add target="_blank" rel="noreferrer" to social links
- Missing comma
- Header title redirects to "/". But my home page is on"/blog", how can I change it. Please help. HOT 1
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 hugo-theme-zzo.