-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Add support for URLs relative to context root #1139
Conversation
@spf13 - what's your thoughts on this one? It is an important use case. One could argue that this should be done at render time, but there is a wormhole of challenges (mainly due to the render once, use twice) with that approach. And the performance penalty from this one is the same as for |
c7ec4e6
to
f25527c
Compare
I think it's a nice addition and there's a solid use case for making the site portable. Since the performance impact isn't much I'd say this is solid. LGTM. |
Good, I'll pull it in, i just have to test a site build on a windows box first. |
c3b3c95
to
aba04f3
Compare
Setting `RelativeURLs` to `true` will make all relative URLs in the site *really* relative. And will do so with speed. So: In `/post/myblogpost.html`: `/mycss.css` becomes `../mycss.css` The same in `/index.html` will become: `./mycss.css` etc. Note that absolute URLs will not be touched (either external resources, or URLs constructed with `BaseURL`). The speediness is about the same as before: ``` benchmark old ns/op new ns/op delta BenchmarkAbsURL 17462 18164 +4.02% BenchmarkAbsURLSrcset 18842 19632 +4.19% BenchmarkXMLAbsURLSrcset 18643 19313 +3.59% BenchmarkXMLAbsURL 9283 9656 +4.02% benchmark old allocs new allocs delta BenchmarkAbsURL 24 28 +16.67% BenchmarkAbsURLSrcset 29 32 +10.34% BenchmarkXMLAbsURLSrcset 27 30 +11.11% BenchmarkXMLAbsURL 12 14 +16.67% benchmark old bytes new bytes delta BenchmarkAbsURL 3154 3404 +7.93% BenchmarkAbsURLSrcset 2376 2573 +8.29% BenchmarkXMLAbsURLSrcset 2569 2763 +7.55% BenchmarkXMLAbsURL 1888 1998 +5.83% ``` Fixes gohugoio#1104 Fixes gohugoio#622 Fixes gohugoio#937 Fixes #157
Merged in beaa8b1 |
57c1d1a67 Add note about issue with Instagram shortcode 2a4355113 Add example for regional language tags (#1139) 5e9a60fc0 Format dates with "th", "nd", and "rd". (#1254) 43df9a7f6 Update index.md f15f32590 Update index.md 5a15be93d Update configuration.md e71c1c545 Update configuration.md 5fd0439ff Release Hugo 0.77.0 5b875477c releaser: Add release notes to /docs for release of 0.77.0 09a2a3199 docs: Regen docs helper bebef9bbe Merge commit '9cabb46f68bae01aeb1859727dcb21e8a10f5ec7' f5ed02685 tpl: Refactor time.AsTime location implementation f3b8eccd2 tpl: Update Hugo time to support optional [LOCATION] parameter git-subtree-dir: docs git-subtree-split: 57c1d1a67b9da5ba8ad5151d464f3fd7a21a24d8
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Add support for URLs relative to context root
Setting
RelativeURLs
totrue
will make all relative URLs in the site really relative.And will do so with speed.
So:
In
/post/myblogpost.html
:/mycss.css
becomes../mycss.css
The same in
/index.html
will become:./mycss.css
etc.Note that absolute URLs will not be touched (either external resources, or URLs constructed with
BaseURL
).The speediness is about the same as before:
Fixes #1104
Fixes #622