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

Add support for URLs relative to context root #1139

Closed
wants to merge 1 commit into from

Commits on May 15, 2015

  1. Add support for URLs relative to context root

    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
    bep committed May 15, 2015
    Configuration menu
    Copy the full SHA
    33ed62b View commit details
    Browse the repository at this point in the history