Skip to content

Prettify attribute output #466

Open
Open
@pimlie

Description

@pimlie

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions