Closed rctay closed 4 years ago
I was worried, as this commit has a potential retrospective effect - because hugo builds the whole site every time, posts that had been published before this commit might be affected if this commit was awry.
I tried to verify that there weren't any changes in the resulting HTML, apart from staging - urls (eg. /images/foo.png
) now correctly contain hugo's baseURL
. Staging was configured with a baseURL
that ended with a path (eg. /271/
), so with this commit, the resulting url now looks like /271/images/foo.png
. To do this, I first built both master and this branch.
# on master
$ git switch master
$ PR_NUMBER=123 bin/build
$ mv public public-master
# switch to this branch
$ git switch responsive-figure-relurl
$ PR_NUMBER=123 bin/build
$ mv public public-responsive
I then constructed a pair of paths, one relative to public-master
and a corresponding one relative to public-responsive
.
$ (cd public-master && find . -type f) | awk '{n=substr($0, 3); printf "\"public-master/%s\" \"public-responsive/%s\"\n", n, n; }'
"public-master/prod/tweet/index.xml" "public-responsive/prod/tweet/index.xml"
"public-master/prod/tweet/placeholder/index.html" "public-responsive/prod/tweet/placeholder/index.html"
"public-master/prod/github.css" "public-responsive/prod/github.css"
"public-master/prod/favicon.ico" "public-responsive/prod/favicon.ico"
"public-master/prod/index.html" "public-responsive/prod/index.html"
"public-master/prod/post/spring-boot-application-with-kotlin/index.html" "public-responsive/prod/post/spring-boot-application-with-kotlin/index.html"
"public-master/prod/post/benchmarking-apache-geodes-performance/index.html" "public-responsive/prod/post/benchmarking-apache-geodes-performance/index.html"
Using this sequence of pairs, I did a diff
between them:
$ (cd public-master && find . -type f) | awk '{n=substr($0, 3); printf "\"public-master/%s\" \"public-resp/%s\"\n", n, n; }' | xargs -n 2 diff -u
--- public-master/staging/123/post/benchmarking-apache-geodes-performance/index.html 2020-06-12 16:42:58.000000000 +0800
+++ public-responsive/staging/123/post/benchmarking-apache-geodes-performance/index.html 2020-06-12 16:45:23.000000000 +0800
@@ -199,7 +199,7 @@
<figure class="center fig-responsive">
- <img src="/images/GeodeBenchmarkFigure1.png" alt="Figure 1: Geode 1.9.0 Average Throughput by Test (in average operations per second) - PartitionedGetBenchmark 203,855; ReplicatedGetBenchmark 244,463; PartitionedPutBenchmark 181,655; ReplicatedPutBenchmark 207,697" />
+ <img src="/123/images/GeodeBenchmarkFigure1.png" alt="Figure 1: Geode 1.9.0 Average Throughput by Test (in average operations per second) - PartitionedGetBenchmark 203,855; ReplicatedGetBenchmark 244,463; PartitionedPutBenchmark 181,655; ReplicatedPutBenchmark 207,697" />
...
There were differences, and as expected, only the output for staging
builds differed.
So, this is a safe commit.
The
relURL
function is flexible enough to accomodate assets that we may or may not host (eg. another domain).https://gohugo.io/functions/relurl/