Skip to content

Support server-side rendering for all types of metaInfo properties #584

Open
@alexlalves

Description

@alexlalves

As far as I am aware, individual metaInfo properties can be configured to only be generated server-side, but I do not think this feature is available for all metaInfo properties.

The documentation is not clear in this regard. It treats all documented metaInfo properties the same (https://vue-meta.nuxtjs.org/api/#metainfo-properties), but it seems that this only applies to some tags.

In src/client/updaters/tag.js

/**
 * Updates meta tags inside <head> and <body> on the client. Borrowed from `react-helmet`:
 * https://github.com/nfl/react-helmet/blob/004d448f8de5f823d10f838b02317521180f34da/src/Helmet.js#L195-L245
 *
 * @param  {('meta'|'base'|'link'|'style'|'script'|'noscript')} type - the name of the tag
 * @param  {(Array<Object>|Object)} tags - an array of tag objects or a single object in case of base
 * @return {Object} - a representation of what tags changed
 */

export default function updateTag (appId, options, type, tags, head, body) {

metaInfo properties like bodyAttr do not work with once or skip. Instead, they are rendered as

<body once="true" skip="true">

client-side. I am currently looking for a solution that only server-side renders body attributes for theming reasons.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions