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

Unexpected comma in title #408

Open
corydeppen opened this issue Oct 9, 2018 · 9 comments
Open

Unexpected comma in title #408

corydeppen opened this issue Oct 9, 2018 · 9 comments

Comments

@corydeppen
Copy link

Similar to #286, I continue to see a comma in the title of pages of my Gatsby app and seems to only be a problem if there's an expression in the title. A reproduction of this issue can be seen in the following branch.

https://github.com/corydeppen/gatsby-8655-example/tree/react-helmet-comma

@edorivai
Copy link

I am seeing both stray commas (,), as well as html comments (<!-- -->).

I've worked around it by using the titleTemplate feature, which completely removed our need to do interpolation.

@AubreyHewes
Copy link
Contributor

AubreyHewes commented Nov 2, 2018

@corydeppen This problem seems to have been fixed a long time ago see pr #351. Merged in to the master by @jamsea, The major problem here is that there has not been a new release/npm/maintenance for about a year (#391). So you are probably using the latest version from npm (https://codesandbox.io/s/8n3z8054k2) from before the possible fix was merged to the master...

Could you possibly create a test against the master?

fyi @tmbtech @cwelch5

Also possible issue template requesting used version?

AubreyHewes added a commit to AubreyHewes/react-helmet that referenced this issue Nov 2, 2018
@tmbtech
Copy link
Contributor

tmbtech commented Nov 2, 2018

Also possible issue template requesting used version?

Yes. I'll write myself a note and try to do it tomorrow morning.

The major problem here is that there has not been a new release/npm/maintenance for about a year

I'll also work on this, I don't see why we can't publish a new build. I'll talk with @cwelch5 in the AM.

tmbtech added a commit that referenced this issue Nov 2, 2018
@chez14
Copy link

chez14 commented Mar 2, 2019

Any updates? I'm still experiencing this issue.

react-helmet@^5.2.0:
  version "5.2.0"
  resolved "https://registry.yarnpkg.com/react-helmet/-/react-helmet-5.2.0.tgz#a81811df21313a6d55c5f058c4aeba5d6f3d97a7"
  integrity sha1-qBgR3yExOm1VxfBYxK66XW89l6c=
  dependencies:
    deep-equal "^1.0.1"
    object-assign "^4.1.1"
    prop-types "^15.5.4"
    react-side-effect "^1.1.0"

Code:

<Helmet {...helmet}>
   <title>{username + " - " + ujian} Ujian</title>
</Helmet>

result:

<title>i16011 - AIF000000, Ujian</title>

@vcarl
Copy link

vcarl commented May 21, 2019

Also still encountering this with latest version. Minimal repro is a handful of lines:

import React from "react";
import ReactDOM from "react-dom";
import Helmet from "react-helmet";

function App() {
  const string = "string";
  return (
    <div>
      <Helmet titleTemplate="%s - template">
        <title>'{string}' not string</title>
      </Helmet>
      butts
    </div>
  );
}

https://nbolv.codesandbox.io/

https://codesandbox.io/s/nbolv

Screen Shot 2019-05-21 at 4 22 35 PM

I poked through the code to see if I could diagnose this, but I'm not familiar with react-side-effect and I can't dedicate time to figure it out right now.

@vcarl
Copy link

vcarl commented May 21, 2019

Nevermind! I hunted it down. master appears to have a fix—but hasn't been backported to 5.2.1. Opened a PR.

@TimboKZ
Copy link

TimboKZ commented Jun 7, 2019

As a temp solution, replacing <title> contents with a single string seems to solve the problem:

<Helmet>
    <title>{`${summary.name} collection`}</title>
</Helmet>

@AubreyHewes
Copy link
Contributor

AubreyHewes commented Oct 9, 2020

If this has been solved, why has it not been resolved....? #391
If this has not been solved, why not?

@ajayunnikuttan
Copy link

I had updated the version to 6.1.0 and the issue is resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants