nfl / react-helmet

A document head manager for React
MIT License
17.28k stars 656 forks source link

[RFF] Avoid Code Duplication #676

Open aress31 opened 2 years ago

aress31 commented 2 years ago

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',
  },