bridget icon indicating copy to clipboard operation
bridget copied to clipboard

Subdirectory support

Open jintaoyugithub opened this issue 10 months ago • 1 comments

Step to reproduce

  1. I installed the theme with github submodule
  2. I copied the config from config/_default/* to the root folder of my site
  3. I create all the necessary folders and files in the content folder
  4. it works perfect with localhost url
  5. I tried hugo -D and deploy all the content in the public to my website, the images won't load (I guess it's because my url is with subdirectory, it's https://jintaoyugithub.github.io/hugo-photofolio/ instead of https://jintaoyugithub.github.io/)

Expected behaviour

can't load the images

Actual Behaviour

load the images

Logs

Failed to load resource: the server responded with a status of 404 () from main.css:1, GeistVF.woff2:1, fw.woff2:1, main.js:1`

I also got a warning:

The resource https://jintaoyugithub.github.io/bundled/css/main.css was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate as value and it is preloaded intentionally.

Addition details

You can check my website.

my hugo.toml setting

# timeout
# timeout = "1200s"
# your website url
baseURL = 'https://jintaoyugithub.github.io/hugo-photofolio/'
# baseURL = 'https://example.org/'
# website title
title = ''
# don't touch this
disableKinds = ["section", "taxonomy", "term", "home"]
# robots.txt
enableRobotsTXT = true
# available options
# * en (powered by Geist)
# * de (powered by Geist)
# * es (powered by Geist)
# * fr (powered by Geist)
# * it (powered by Geist)
# * zh-sg zh-cn (powered by Noto Sans SC)
# * zh-hk zh-tw zh-mo (powered by Noto Sans TC)
# * ja (powered by Noto Sans JP)
# * ko (powered by Noto Sans KR)
# * ta (powered by Noto Sans TA)
defaultContentLanguage = 'en'

# theme as module
[module]
replacements = "github.com/Sped0n/bridget/v2 -> bridget" # deploy with local dir (relative to hugo site theme dir)  WARN: delete this line if you want to deploy with git
# [[module.imports]]
# path = "github.com/Sped0n/bridget/v2" # deploy with git (recommended)  WARN: you should also set `bundled` to true in params.toml !!!

I also copied other settings from config/_default to the root folder of the site.

the structure of the content folder looks like:

.
├── about
│   └── index.md
├── france
│   ├── 1.jpg
│   └── index.md
├── germany
│   ├── 1.jpg
│   └── index.md
├── iceland
│   ├── 1.jpg
│   └── index.md
├── shanghai
│   ├── 1.jpg
│   └── index.md
└── sweden
    ├── 1.jpg
    └── index.md

Hugo version

hugo v0.143.1+extended+withdeploy darwin/arm64 BuildDate=2025-02-04T08:57:38Z VendorInfo=brew

Bridget version

v2.0.5

OS version

macos 15.1

Verify steps

  • [ ] Pull request is welcome. Check this if you want to start a pull request
  • [x] I have searched on Issue Tracker, No duplicate or related open issue has been found
  • [x] Ensure there is only one bug report in this issue. Please make mutiply issue for mutiply bugs

jintaoyugithub avatar Mar 13 '25 22:03 jintaoyugithub

thing is that, resources indexing in this theme is mostly depend on href indexing, which means, the theme asserts(presumes) all these resources lying under(or relative to) the root url

but after u set up the site with a sub path, all these resources are under the sub path(not root path)

kinda see the cause behind it right?

issue #476 also try to deploy on sub path and got the same error (tho the author didnt mention this)

Image

if u insist on going with sub path, maybe u can try hardcode all href indexing in sass and tsx

as for the support for sub path, currently I don't have the interest and efforts, sorry

maybe after my summer internship i can try to implement this, but still, don't hold high expectations


Edited

or u can try to modify all href indexing from /a/b to a/b (remove the heading slash), so indexing is relative to current document instead of domain name

Sped0n avatar Mar 29 '25 06:03 Sped0n

sorry to keep you waiting, should be fixed by https://github.com/Sped0n/bridget/releases/tag/v2.1.0

feel free to reopen this issue if any problems persist

Sped0n avatar Nov 11 '25 18:11 Sped0n