react-helmet icon indicating copy to clipboard operation
react-helmet copied to clipboard

[RFF] Avoid Code Duplication

Open aress31 opened this issue 3 years ago • 0 comments

The way I configure the SEO of my website using Helmet is as follows:

  '/': {
    meta: [
      {
        content:
          'X',
        name: 'description',
      },
      {
        content:
          'X',
        property: 'og:description',
      },
      {
        content: 'Home',
        property: 'og:title',
      },
      {
        content: 'Y',
        property: 'og:url',
      },
    ],
    title: 'Home',
  },

I tend - and I am sure I am not the only one - to use the same og:description and description. Therefore, this adds a lot of code duplication - and my entries can be quite lengthy.

Could it be possible to specify an array for the property? For example:

'/': {
    meta: [
      {
        content:
          'X',
        name: ['description', 'og:description'],
      },
      {
        content: 'Home',
        property: 'og:title',
      },
      {
        content: 'Y',
        property: 'og:url',
      },
    ],
    title: 'Home',
  },

aress31 avatar Mar 02 '22 15:03 aress31