Skip to content

Title component doesn't override default <title> tag provided via HTML template #83

@rdsedmundo

Description

@rdsedmundo

I'm using client-side rendering and react-head is not able to replace a default tag that I provided on my HTML template. It only adds a new <title> tag at the end of the head, and due to the browser behavior, only the first one is actually used. react-helmet as a reference supported this fine.

template.html

<html>
  <head>
    <title>Test</title>
  </head>
  <body>
     <div id="react-mount"></div>
  </body>
</html>

index.js

import React from 'react';
import ReactDOM from 'react-dom';

import { Title, HeadProvider } from 'react-head';

ReactDOM.render(
  <div>
    <HeadProvider>
      <Title>Test2</Title>
    </HeadProvider>
  </div>
  document.getElementById('react-mount'),
)

The expected behavior for me is that Test2 is going to replace and be the title of the page, but what happens is that Test remains as the title, as its tag is positioned first.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions