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

Lack of documentation around adding meta tags info in template.html #1561

Open
lego-sharat opened this issue May 17, 2021 · 1 comment
Open
Labels

Comments

@lego-sharat
Copy link

My requirement was to add meta tags, so that when sharing links on twitter/fb/whatsapp a link preview should appear. I needed to add meta tags for this purpose. There is not a lot of documentation around that. Two things which are mentioned are preact-cli uses ejs and template.html has preact.title for dynamically showing title. Other than that, I couldn't find anything. I was able to figure out a solution by looking at the source code of the preact documentation site, where something like this is being used <%= htmlWebpackPlugin.options.CLI_DATA.preRenderData.description %>.
So my questions are :

  • Is this the recommended way to add meta tags in a prect-cli project?
  • If no then what is the recommended way?
  • If yes then, is there any other data is useful which is being exposed like this and where should I look for that(this is for my own learning)

Also, I am willing to add the necessary documentation for this if but advance warning I don't have a lot of knowledge on html-webpack-plugin.

PS:
Apologies if I have missed some obvious place which has the documentation
And thanks for making this really useful framework

@rschristian
Copy link
Member

rschristian commented May 17, 2021

Sorry, could use some extra docs there, but feel free to add.

If you look, preact-www uses preact build --prerenderUrls src/prerender.js ... as its build command, which leads here.

preRenderData.description isn't something that is exposed automatically, as it's coming entirely from that prerender script.

You can make your own script to generate whatever values you need.

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

No branches or pull requests

2 participants