replace the page meta and link with global meta on nuxt

Viewed 132

Why doesn't the local configuration for meta title and description override the global configuration

The problem is that when I change the meta tags and links on the page, it removes the meta tags that are global and replaces the new meta tags. I want these meta and links to be added to the global meta and links.

In the meta tag and global links that I have, I have a part that makes the logo part of the site correct when adding a bookmark in Safari, but when I add the meta tag to my page, the photo is no longer loaded, and I think the problem is from It is that Next replaces the meta tags that are created on each page instead of the global meta tags

Code

**this is my nuxt config code**


 head: {
        title: 'Flyver',
        htmlAttrs: {
          lang: 'en',
        },
        meta: [
          .........
          { charset: 'utf-8' },
          {
            name: 'viewport',
            hid: 'viewport',
            content:
              'width=device-width,initial-scale=1,shrink-to-fit=no,maximum-scale=5,viewport-fit=cover',
          },
          { hid: 'description', name: 'description', content: '' },
          { name: 'format-detection', content: 'telephone=no' },
          {
            hid: 'apple-mobile-web-app-status-bar-style',
            name: 'apple-mobile-web-app-status-bar-style',
            content: 'black-translucent',
          },
          .........
        ],
        link: [
          .........
    
          {
            hid: 'apple-touch-icon',
            rel: 'apple-touch-icon',
            href: '/android-chrome-180x180.png?v=sf54fgh123',
            type: 'image/png',
            sizes: '180x180',
          },
          {
            hid: 'apple-touch-icon1',
            rel: 'apple-touch-icon',
            href: '/apple-touch-icon.png?v=sf54fgh123',
            type: 'image/png',
            sizes: '120x120',
          },
          .........
      },


    this is my index page** 

  

    async fetch() {
      ........
        this.headValue = {
          title: this.pageData?.value?.title,
          link: [
            {
              rel: 'canonical',
              href: `https://flyver.ir`,
            },
          ],
          meta: [
            {
              name: 'description',
              content: this.pageData?.value?.description,
            },
            
            ...this.pageData?.metaTags,
          ],
        };
        ..........
      },
      head() {
        return this.headValue;
      },

What is Expected? I expect the meta tags that are created per page to be added to the global meta tags

What is actually happening? Replaces new meta tags with global meta tags

0 Answers
Related