Giter VIP home page Giter VIP logo

Comments (14)

zzossig avatar zzossig commented on August 17, 2024 2

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.

zzossig avatar zzossig commented on August 17, 2024

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.

Lemania avatar Lemania commented on August 17, 2024

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.

zzossig avatar zzossig commented on August 17, 2024

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.

Lemania avatar Lemania commented on August 17, 2024

Yes I prefer to keep the blog folder

In fact this notation works : ![Example image](/blog/images/whoami/avatar.jpg)

from hugo-theme-zzo.

zzossig avatar zzossig commented on August 17, 2024

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.

Lemania avatar Lemania commented on August 17, 2024

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.

zzossig avatar zzossig commented on August 17, 2024

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.

zzossig avatar zzossig commented on August 17, 2024

@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.

yanlinlin82 avatar yanlinlin82 commented on August 17, 2024

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.

zzossig avatar zzossig commented on August 17, 2024

@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.

yanlinlin82 avatar yanlinlin82 commented on August 17, 2024

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:

  1. create a temp test dir, and go into it:
    mkdir hugo-test
    cd hugo-test
    
  2. clone you repo:
    git clone https://github.com/zzossig/hugo-theme-zzo zzo
    
  3. go into example dir:
    cd zzo/exampleSite/
    
  4. change the config (add sub-dir foo):
    sed -i 's,^\(baseURL.*\)"$,\1/foo",' config/_default/config.toml
    
  5. 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
    
  6. start hugo server
    hugo server --themesDir ../..
    
  7. 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.
    <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>
    Here, the image src attribute is "/images/test.img", but not "/foo/images/test.img".

from hugo-theme-zzo.

zzossig avatar zzossig commented on August 17, 2024

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.

zzossig avatar zzossig commented on August 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.