Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imge url not correct if baseurl defined #1218

Open
simonstumpf opened this issue Apr 3, 2024 · 3 comments
Open

imge url not correct if baseurl defined #1218

simonstumpf opened this issue Apr 3, 2024 · 3 comments

Comments

@simonstumpf
Copy link

Description

When building with a baseUrl (https://myservice.test.ch/abc/ in my case), the image paths don't seem quiet right.
The links are then: <img src=https://myservice.test.ch/abc/abc/docs/artifactory/art.... As you can see /abc is duplicated in the path (if this duplication is removed, it works fine).

Steps to reproduce

define a baseurl with a subpath and use some local pictures.
![myPicutre](artifactory-user-passwordgen.png)

Expected result

the baseurl should be correct applied and not twice.

Actual result

the baseurl got applied twice https://myservice.test.ch/abc/abc/

Environment

Paste the information here as shown by npm run info

> [email protected] preinfo
> npm version

{
  test: '0.0.0',
  npm: '10.2.0',
  node: '21.1.0',
  acorn: '8.10.0',
  ada: '2.7.2',
  ares: '1.20.1',
  base64: '0.5.0',
  brotli: '1.1.0',
  cjs_module_lexer: '1.2.2',
  cldr: '43.1',
  icu: '73.2',
  llhttp: '9.1.2',
  modules: '120',
  napi: '9',
  nghttp2: '1.57.0',
  openssl: '3.1.3',
  simdutf: '3.2.18',
  tz: '2023c',
  undici: '5.26.4',
  unicode: '15.0',
  uv: '1.46.0',
  uvwasi: '0.0.19',
  v8: '11.8.172.15-node.14',
  zlib: '1.2.12'
}

> [email protected] info
> npm list

[email protected] /Users/simonstumpf/raiffeisen/git/pace-customer-docs
├── @hyas/[email protected]
├── @hyas/[email protected]
├── @hyas/[email protected]
├── @hyas/[email protected]
├── @tabler/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]


> [email protected] postinfo
> exec-bin node_modules/.bin/hugo/hugo version

hugo v0.123.7-312735366b20d64bd61bff8627f593749f86c964+extended darwin/amd64 BuildDate=2024-03-01T16:16:06Z VendorInfo=gohugoio
@h-enk
Copy link
Member

h-enk commented Apr 4, 2024

In config/_default/hugo.toml with

baseurl = "http://localhost/"

running

pnpm dev --baseURL="http://localhost/subdir/"

works for me OK

Snag_a7ed028

@simonstumpf
Copy link
Author

I agree that works. But if I execute npm run build (baseurl="https://myservice.test.ch/abc/" in production/config.toml), the generated public folder holds these incorrect URLs:

<img src=https://myservice.test.ch/abc/abc/docs/artifactory/artifactory-overview_hu1dbfdd588fb0cc2f17a368000f94ac4d_78905_1897x751_resize_q85_h2_lanczos_3.webp width=1897 height=751 decoding=async fetchpriority=auto loading=lazy alt="Manage Permission" id=h-rh-i-2></p>

@h-enk
Copy link
Member

h-enk commented Apr 4, 2024

Yes, you'll also need publishDir. In config/production/hugo.toml, set:

# Overrides for production environment
baseurl = "http://172.21.64.1:8080/subdir/"
publishDir= "/public/subdir/"

Snag_d0b3c5c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants