feat(pat-inject): More metadata updates for history:record injections.#1280
Open
feat(pat-inject): More metadata updates for history:record injections.#1280
Conversation
When the navigation URL changes on injections with the ``history:record`` setting, also update the canonical url (``<link rel="canonical" href="URL"/>``) and the base url (``<base>URL</base>``). For the canonical and base tags, the logic is as follows: - If present in source and target, update it in the target. - If present in source but not in target, add it to the target. - If present in target but not in source, remove it from the target. It's better to have no canonical or base tag than an incorrect one. For the title tag the logic is different, as the title is never removed from the target. It's better to have any title than none.
Throw an event before the history is updated and the URL bar changes and pass the original AJAX event along with it. This allows external code to do some updates, like changing data-base-url and data-view-url on the body, using the body information from the response for that. This is a use-case in Plone and allows JavaScript code to get information on the current context.
dae949c to
bc4c34f
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When a URL manipulating injection with the history:record setting is done, we also want a bunch of other data be updated. That includes:
We already had support for the title tag in the head section of the document. This PR adds support for
<link rel="canonical" href="..." />and<base href="...">tags.