Skip to content

Subdirectory support #473

@jintaoyugithub

Description

@jintaoyugithub

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
  • I have searched on Issue Tracker, No duplicate or related open issue has been found
  • Ensure there is only one bug report in this issue. Please make mutiply issue for mutiply bugs

Metadata

Metadata

Assignees

Labels

C: OtherOther (e.g. client side logic) changeT: FeatureNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions