vue-meta
vue-meta copied to clipboard
Prettify attribute output
Since v2.3.0 vue-meta adds the attributes as JSON object on the html/head/body tags to keep track which app added which attribute value. On hydration these json's are moved to an internal object, but if you do view-source they are visible.
The resulting code doesnt look really nice because the json objects needs to be url encoded. We could try to prettify the output by:
- adding attributes back again in the form of
data-[attribute]-[appId]-[attributeName]="[attributeValue]"This requires parsing the attributes on hydration and create the JSON again - implement a vue-meta option a user can use to indicate they will be calling
meta().script.text()so we can just add ascripttag which holds the json object
For the latter we should also choose on either setting a global prop or adding an id and go through the DOM to parse the textContent of the script tag as json.