-
Notifications
You must be signed in to change notification settings - Fork 989
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
Compute canonical path before adjusting parent path #856
Conversation
I think we also need to strip the language tag from the filename when generating the canonical path, otherwise translations are not found. Do you want me to add this change to this PR or do you prefer when I open a new one? |
I mean that's weird that it was not doing it, I swear I had code to handle that.. :( |
Maybe you mean this code? zola/components/library/src/content/file_info.rs Lines 114 to 143 in 6d7c95e
This line seems to have the same problem:
You're using the adjusted |
I pushed a second commit that also fixes the issue in |
- Test for correct canonical field when calling `new_page` - Test for correct canonical field after calling `find_language`
I added some basic regression tests for the two commits. |
); | ||
let res = file.find_language(&config); | ||
assert!(res.is_ok()); | ||
assert_eq!(file.canonical, Path::new("/home/vincent/code/site/content/posts/tutorials/python/index")); |
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.
I think the reason for those bugs is that in my mind the canonical path was /home/vincent/code/site/content/posts/tutorials/python
.
Anyway, thanks a lot!
* Compute canonical path before adjusting parent path * Don't use adjusted `parent` to recalculate `canonical` in `find_language` * Add regression tests - Test for correct canonical field when calling `new_page` - Test for correct canonical field after calling `find_language`
Fixes #854