-
Notifications
You must be signed in to change notification settings - Fork 977
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
Issue 2359 get section by lang #2410
Conversation
Thinking about it a bit more, we don't have it for |
…k for language available in config.
Good call on adding it to |
} | ||
} | ||
|
||
fn calculate_path<'a>( |
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'm not sure calculate_path is the right name. get_path_with_lang
? Not sure
@@ -154,6 +160,12 @@ If you only need the metadata of the section, you can pass `metadata_only=true` | |||
{% set section = get_section(path="blog/_index.md", metadata_only=true) %} | |||
``` | |||
|
|||
If selecting a specific language for the section, you can pass `lang` with the language code to the function: |
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 would mention for pages and here that it's equivalent to {% set section = get_section(path="blog/_index.fr.md") %}
…. Modify documentation for get_section and get_page to include equivalent calls without using lang argument to demostrate how lang argument effects pathing.
Great. Changed the function name to be more specific, like you suggested. Also, added to the docs equivalencies based on if the language passed is the default language or not. |
Thanks! |
* adding optional `lang` arugment to `get_section` global function * Add handling of default language passed in `lang` argument of `get_section` * Remove clones for path. Change "?" to an explicit check for error * lint changes * Clean up error handling for add_lang_to_path call * fix format * Add optional parameter "lang" to get_page template function. Add check for language available in config. * Modify helper function name from calculate_path to get_path_with_lang. Modify documentation for get_section and get_page to include equivalent calls without using lang argument to demostrate how lang argument effects pathing.
* adding optional `lang` arugment to `get_section` global function * Add handling of default language passed in `lang` argument of `get_section` * Remove clones for path. Change "?" to an explicit check for error * lint changes * Clean up error handling for add_lang_to_path call * fix format * Add optional parameter "lang" to get_page template function. Add check for language available in config. * Modify helper function name from calculate_path to get_path_with_lang. Modify documentation for get_section and get_page to include equivalent calls without using lang argument to demostrate how lang argument effects pathing.
* adding optional `lang` arugment to `get_section` global function * Add handling of default language passed in `lang` argument of `get_section` * Remove clones for path. Change "?" to an explicit check for error * lint changes * Clean up error handling for add_lang_to_path call * fix format * Add optional parameter "lang" to get_page template function. Add check for language available in config. * Modify helper function name from calculate_path to get_path_with_lang. Modify documentation for get_section and get_page to include equivalent calls without using lang argument to demostrate how lang argument effects pathing.
Adding optional
lang
argument forget_section
global function. Language code will be added to the filename if it is not the default language. Related issue here.Sanity check:
Code changes
next
branch?If the change is a new feature or adding to/changing an existing one: