Skip to content

Instantly share code, notes, and snippets.

@PuruVJ
Last active April 18, 2020 17:42
Show Gist options
  • Save PuruVJ/95cb8dccd33e4c67d718e7dce8348c69 to your computer and use it in GitHub Desktop.
Save PuruVJ/95cb8dccd33e4c67d718e7dce8348c69 to your computer and use it in GitHub Desktop.
Helmet Usage
import { Component, Prop, h } from '@stencil/core';
import Helmet from "/path/to/helmet.tsx";
@Component({
tag: 'my-first-component',
})
export class MyComponent {
// Indicate that name should be a public property on the component
@Prop() name: string;
render() {
return (
<p>
My name is {this.name}
<Helmet>
<meta name="theme-color" content="#fefefe" />
<title>Hello World</title>
{/* And any tags can be used in here. They would be put in <head>, or replaced if they already exists.
Note: The replacement will happen only for meta[name] tags as they are the most used ones
*/}
</Helmet>
</p>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment