-
Notifications
You must be signed in to change notification settings - Fork 991
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
Allow redirections to external URLs #1844
Comments
Wouldn't you want to use 301 or 302 in that case? |
Well if we could get the server to redirect a few URLs, we would, but in many cases such as using GitHub Pages, you just do not have control over the server's responses. Zola already has I made a workaround by copying the built-in |
zola/components/config/src/config/mod.rs Lines 173 to 194 in ede306c
This seems like the code responsible for adding the base URL. Adding a check for |
It should be changed upstream of that function, not in there. This function is responsible for making permalinks in the current site. |
Ah, sorry. That makes sense. |
Sorry for the very late reply. I think it would be ok to add |
Huh, from what I can see in the code is that link parsing in articles is done by the |
In this issue, you only need to handle the redirect on a section so the line you have to change is https://github.com/getzola/zola/blob/next/components/site/src/lib.rs#L1117 |
Bug Report
Environment
Zola version: 0.15.3
Expected Behavior
Tell us what should have happened.
When setting
redirect_to
on a section's_index.md
to an external URL, the redirection page should redirect to the external URL.Current Behavior
Tell us what happens instead of the expected behavior. If you are seeing an
error, please include the full error message and stack trace. You can get the
stacktrace of a panic by adding
RUST_BACKTRACE=1
when running azola
command.The site's base URL gets concatenated to the external URL: with a base URL at
https://foo.com
andredirect_to = "https://bar.com/something"
, the user gets redirected tohttps://foo.com/https://bar.com/something
.Step to reproduce
Please provide the steps to reproduce the issue.
If the issue is hard to reproduce, please provide a sample repository or sample
that triggers the bug.
Set the site's base URL to
https://foo.com
Create an
_index.md
anywhere in a site's content, and set a redirection:Generate the site.
Open the section that you created.
You will get redirected to
https://foo.com/https://bar.com/something
.The text was updated successfully, but these errors were encountered: