Add API for idempotent page description editing #1765
Merged
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.
setDescription
andsetDescriptionI
are slightly surprising in that they are not idempotent, and multiple calls to these functions will insert multiple<meta>
tags in the page head. Since these functions present likesetTitle
andsetTitleI
, I would have expected them to have a similar idempotent behaviour.This adds idempotent versions of these functions, which behave like
setTitle
andsetTitleI
in that they store information in the page data and can be called any number of times, taking the final value supplied.Because they use the page data, these functions can't be drop-in replacements for the existing functions - users with custom layouts will have to manually edit them to use the new idempotent functions, since they have to explicitly include the new
pageDescription
field in their layouts (while the old functions write to the page head.)Points for review
description
as a meta tag to something stored in the page data sensible? Should the same approach be taken for other meta tags? Should arbitrary meta tags appear in the page data?Before submitting your PR, check that you've:
@since
declarations to the Haddocks for new, public APIsAfter submitting your PR: