vue-meta icon indicating copy to clipboard operation
vue-meta copied to clipboard

Prettify attribute output

Open pimlie opened this issue 6 years ago • 0 comments

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 a script tag 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.

pimlie avatar Oct 08 '19 08:10 pimlie