Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm what does this do in practice? Do we want it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, to be honest I was hoping you might know better than I.
It restores the logic here: 4bf67af#diff-05643f021a24da1c9475eb37428b799095c0cfbd79f1b79e658c39615746315dL357-L361
This never came up as I was testing #2311 as it doesn't actually seem to have any effect on the generated site. All the permalinks render as one might expect whether you strip that trailing slash or not. EXCEPT, in one case that I've been able to spot so far.
On my site, using the Anpu theme for a base, the
config.toml
calls for a few navigation links that are specified like so:On these links, and only these links it seems, if that logic does not exist to strip the trailing slash to match
base_url
in the site config, then the links render with an extra slash, e.g.,http://127.0.0.1:1111//about
.To verify that the logic here matches the prior behaviour, I took the new unit tests that I've begun preparing in #2448 and grafted them onto the parent commit of 4bf67af, and the applicable tests pass.
I admit I find the logic around trailing slashes in zola to be a bit intractable. It seems we expect them throughout, but we do not expect it on the base URL as specified in
config.toml
, so this little snippet allows theserve
logic to match thebuild
logic.I'm super curious what your thoughts are vis-à-vis trailing slashes in general and how they should be treated. Perhaps my understanding is incorrect, or perhaps this is more indicative of the theme constructing URLs in a non-idiomatic way? There may be some opportunity to clean things up beyond this PR, but this one is merely to match the behaviour on the
next
branch to that onmaster
so there are no surprises in the next release.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory every URL in zola should have a trailing slash. I'm guessing we should probably remove one from the base_url when loading the config if there is one to ensure it is uniform and remove a few checks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems like a logical approach to me. Thanks for merging!