Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature to allow duplication of explicitly specified meta tags #4656

Closed
5t111111 opened this issue Jun 24, 2018 · 2 comments · Fixed by #5800
Closed

Feature to allow duplication of explicitly specified meta tags #4656

5t111111 opened this issue Jun 24, 2018 · 2 comments · Fixed by #5800

Comments

@5t111111
Copy link
Contributor

Feature request

Is your feature request related to a problem? Please describe.

In some use cases, we have to set meta tags with the same name (See #4407 for an actual example of use case) . However, you cannot do that because of next/head's duplication-filter feature.

Although, thanks to #4121, in the latest version of Next.js you can set multiple article:tag meta tag as long as they have unique keys, the tag name is hard-coded and you seem to have no way to add other meta tags to ALLOWED_DUPLICATES.

Describe the solution you'd like

It would be great if users can explicitly specify meta tag names to be allowed (e.g. by configuring next.config.js) .

Describe alternatives you've considered

Provide a way of whatever allow duplication (like specifying by environment variables) .

Additional context

We are willing to send you a pull-request if the above concept is acceptable.

@jaydenseric
Copy link
Contributor

Does this duplicate #3705?

@lqt93
Copy link

lqt93 commented Jul 25, 2018

How is it going? I really need a feature like this.

timneutkens added a commit that referenced this issue Dec 3, 2018
Fixes #3705
Fixes #4656

- No longer automatically dedupe certain tags. Only the ones we know are *never* going to be duplicate like charSet, title etc.
- Fix `key=""` behavior, making sure that if a unique key is provided tags are deduped based on that.

For example:

```jsx
<meta property='fb:pages' content='one'>
<meta property='fb:pages' content='two'>
```

Would currently cause

```jsx
<meta property='fb:pages' content='two'>
```

### After this change:

```jsx
<meta property='fb:pages' content='one'>
<meta property='fb:pages' content='two'>
```

Then if you use next/head multiple times / want to be able to override:

```jsx
<meta property='fb:pages' content='one' key="not-unique-key">
<meta property='fb:pages' content='two' key="not-unique-key">
```

Would cause:

```jsx
<meta property='fb:pages' content='two'>
```

As `key` gets deduped correctly after this PR, similar to how React itself works.
@lock lock bot locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants