-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add meta tags to pages #10
Comments
I got an idea 😉
{
"routes": {
"index/": {
"title": "index page",
"keywords": "foods, art",
"url": "http://example.com/index",
"site_name": "the site name",
"description": "some descriptions"
},
"about/": {
"title": "about page",
"keywords": "about",
"url": "http://example.com/about",
"site_name": "the site name",
"description": "some descriptions"
}
}
}
export default function PageMeta({ metaInfo }: { metaInfo: string }) {
const { title, keywords, url, siteName, description } = parseMetaInfo(
metaInfo,
);
return (
<>
<meta name="description" content={description} />
<meta name="keywords" content={keywords} />
<meta property="og:url" content={url} />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:site_name" content={siteName} />
</>
);
} |
I like the idea of centralize metatags. A few points though:
@notangelmario what do you think ? |
Yeah, I totally agree with you. |
@xstevenyung Html injection is not yet supported in Fresh. But there are plans to achieve it in the near future. Should we make a solution before this feature rolls out, or should we wait? @sinyo-matu We could apply your idea, it looks great! |
I've tried the fresh plugin system. And it does easy to use! In spite of It being almost a waste of time, actually, I write a live demo of plugin you guys can check: the source code is here. |
yeah that's what I thought, we can make an initial version using a the solution would definitely be good enough. @sinyo-matu the initial version looks promising! could you push a PR so we can check it out and discuss it further? |
We could make the init.ts add the component automatically though. With a little bit of tinkering we could automate this process. |
@notangelmario If we manage to do it properly, but I don't think it should be a requirement to automate this in the It could take a lot of time and be really tricky to add the proper line at the right place without overriding user code (for example if the user already has a |
@xstevenyung Yeah... I guess adding lines to app.tsx could spawn some problems and a lot of hacky code. A library to help with this might be a little too much of a hassle. |
I will submit a PR later. |
Add meta tags to all pages to improve link querying and social links.
The text was updated successfully, but these errors were encountered: