-
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
Issue 2359 get section by lang #2410
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
444ddf6
adding optional `lang` arugment to `get_section` global function
SumDonkuS 4814e3c
Add handling of default language passed in `lang` argument of `get_se…
SumDonkuS 4bedd14
Remove clones for path. Change "?" to an explicit check for error
SumDonkuS 7ea1376
lint changes
SumDonkuS 113553b
Clean up error handling for add_lang_to_path call
SumDonkuS 68b3c29
fix format
SumDonkuS 86ea4df
Add optional parameter "lang" to get_page template function. Add che…
SumDonkuS 5ef7e4b
Modify helper function name from calculate_path to get_path_with_lang…
SumDonkuS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,6 +141,12 @@ Takes a path to an `.md` file and returns the associated page. The base path is | |
{% set page = get_page(path="blog/page2.md") %} | ||
``` | ||
|
||
If selecting a specific language for the page, you can pass `lang` with the language code to the function: | ||
|
||
```jinja2 | ||
{% set page = get_page(path="blog/page2.md", lang="fr") %} | ||
``` | ||
|
||
### `get_section` | ||
Takes a path to an `_index.md` file and returns the associated section. The base path is the `content` directory. | ||
|
||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. I would mention for pages and here that it's equivalent to |
||
|
||
```jinja2 | ||
{% set section = get_section(path="blog/_index.md", lang="fr") %} | ||
``` | ||
|
||
### `get_taxonomy_url` | ||
Gets the permalink for the taxonomy item found. | ||
|
||
|
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.
i'm not sure calculate_path is the right name.
get_path_with_lang
? Not sure