solid-meta
solid-meta copied to clipboard
Title tag not changing
Maybe I don’t understand something, but I can’t change the title tag at all.
I even copied the 1in1 code from the repository + created an empty project, anyway, the title and other tags do not changeю
javscript not throwing any errors.
Maybe it has something to do with solid-router because they have at least one common <Link> tag, but I could be wrong. Doesn't work without <Router> either.
import type { Component } from 'solid-js';
import { Meta, MetaProvider, Title } from '@solidjs/meta';
const App: Component = () => (
<MetaProvider>
<div class="Home">
<Title>Title of page</Title>
<Meta name="example" content="whatever" />
// ...
</div>
</MetaProvider>
);
export default App;
import { render } from 'solid-js/web';
import App from './App';
import { Router } from '@solidjs/router';
render(() => <Router><App /></Router>, document.getElementById('root') as HTMLElement);
would you be able to put this in codesandbox.io or something similar so we could see what the issues are?
I had similar issue while testing the lib with just a title. I removed the hard coded title from the html then it worked.
I think that the hard coded title should serve as a fallback (no js required). Is there a way to make meta work without removing the title from the html?
We never removed or commandeered the title tag if it didn't have a data-sm attribute. 0.28.0 removed the ability to have an existing title tag at all, but that should have been fixed in 0.28.2.
The solution as it was in 0.27.5 is to add an empty data-sm attribute to it.
@ryansolid thank you for fast answer (for history: there was my deleted message here 3 minutes before answer)
Sorry i run on outdated solid-meta 0.28.1
Problem solved after move to @solidjs/meta and latest version
@awfulminded can you check on latest @solidjs/meta and confirm on you side?
@ryansolid @botanegg the issue is still reproducible on 0.28.2
@boombang I just fix this by remove
In my opinion, not only should the title in the MetaProvider be cascaded, but the title already in index.html should also be overwritten.
This is because there is already a rule that only the ‘last created one’ is applied to the titles in the MetaProvider.
Have the same issue. Removing tags from html file is not an option, I am using SPA and I would lose link previews while sharing the link. The problem solved by adding empty data-sm attribute to existing tags.