Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

Duplicate lang, language, charset meta tags when target:static #96

Open
@abernh

Description

When using with target:static multiple meta tags are duplicated in my generated html files.
E.g. lang, charset, language, viewport, ... all meta tags, that modules.js are handled during generate() as "without content"

Investigating the issue I found, that this is a "problem" with vue-meta.
when vue-meta is refreshing the metas it removes duplicates only based on the given hid
If there is no hid set, then it is possible, that a single meta value is added multiple times.

Proposed fix

Adding hid based on meta.id when generating the metas so that vue-metas filtering works as expected.

//modules.js:241
  const generate = (metas, optionsGenerate, id = '', index = false) => {
      ...

      if (meta.value && meta.multi && Array.isArray(meta.value)) {
        ...
      } else if (typeof meta.value === 'object' && !Array.isArray(meta.value)) {
        ...
      } else if (meta.content) {
        ...
      } else if (meta.id) {
        if (meta.ids) {
          meta.ids.map(id => {
            ...

            outputMeta.push({
              hid: id, // -------------------> add hid
              [id]: meta.value
            })
          })
        } else {
          ...     

          outputMeta.push({
            hid: meta.id, //  -------------------> add hid
            [meta.id]: meta.value
          })
        }
      }
    })
  }

I'll prepare a PR

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions