-
Notifications
You must be signed in to change notification settings - Fork 86
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
Some small gotcha with snippets #836
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #836 +/- ##
========================================
Coverage 93.07% 93.07%
========================================
Files 47 47
Lines 4144 4144
Branches 704 529 -175
========================================
Hits 3857 3857
Misses 173 173
Partials 114 114 ☔ View full report in Codecov by Sentry. |
@@ -0,0 +1,19 @@ | |||
# Snippets and Synchronization | |||
Imagine you have a page with related tags added via snippets, and you want to query all pages with a specific tag. |
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.
could you add a code snippet illustrating this?
it will help people contextualize the scenario
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 what you mean. I added a code snippet at the bottom ?
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.
the tags as snippets, and how they are added to the page
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.
added full example, hope this helps
Added a better code example
When using snippets and translations there is a gotcha you might encounter. This might save somebody couple of hours figuring it out.
Imagine you have a page with related tags added via snippets, and you want to query all pages with a specific tag.
When synchronous translation is enabled, the tag will refer to the default language. However, if the user turns off
synchronous translation, the tag will refer to the page’s language. This could mean the user references a translated tag
within the translated page, causing the query to miss some pages tagged with the original tag.
To solve this, you can query both the default language and the current language, then filter based on the active
language.