Skip to content
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

Get term fn #1964

Merged
merged 2 commits into from
Aug 24, 2022
Merged

Get term fn #1964

merged 2 commits into from
Aug 24, 2022

Conversation

scouten
Copy link

@scouten scouten commented Aug 13, 2022

As discussed in #1897, this adds a new get_term global function which returns a single TaxonomyTerm item instead of the entire site. In the personal site discussed in that issue, this results in a 4x improvement in rendering speed (5.4s vs 22.1s).

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Code changes

  • Are you doing the PR on the next branch?

If the change is a new feature or adding to/changing an existing one:

  • Have you created/updated the relevant documentation page(s)?

Copy link
Collaborator

@Keats Keats left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good except the name and that it needs a rebase

@@ -180,6 +180,23 @@ items: Array<TaxonomyTerm>;

See the [Taxonomies documentation](@/documentation/templates/taxonomies.md) for a full documentation of those types.

### `get_term`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we call it get_taxonomy_term?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I'll rename in next day or so.

@scouten
Copy link
Author

scouten commented Aug 17, 2022

@Keats updated as requested.


`lang` (optional) default to `config.default_language` in config.toml

`include_pages` (optional) default to true. If false, the `pages` item in the `TaxonomyTerm` is replaced with `page_count`, an integer with the number of pages for this term.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at it again, I think page_count should be additional field that is always passed and this arguments just make pages an empty array.

@Keats Keats merged commit b01e99b into getzola:next Aug 24, 2022
@Keats
Copy link
Collaborator

Keats commented Aug 24, 2022

Thanks!

@scouten scouten deleted the get-term-fn branch August 27, 2022 16:05
Keats pushed a commit that referenced this pull request Feb 16, 2023
* Add new `get_taxonomy_term` global function

* Update per @Keats feedback to make `page_count` available all the time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants