@davidlj95/ngx-meta
v1.0.0-beta.31
Published
Set your Angular site's metadata: standard meta tags, Open Graph, Twitter Cards, JSON-LD structured data and more. Supports SSR (and Angular Universal). Use a service. Use routes' data. Set it up in a flash! π
Downloads
1,855
Maintainers
Readme
Set your Angular site's metadata: standard meta tags, Open Graph, Twitter Cards, JSON-LD structured data and more. Supports SSR (and Angular Universal). Use a service. Use routes' data. Set it up in a flash! π
[!NOTE] Current version is a beta. APIs are now very stable and very open for feedback. Version 1.0.0 will be published after it has been in the wild for a while
Motivation
You have a nice Angular-powered website. You want to improve its SEO and decide to add some metadata in your pages. You also enable Server Side Rendering (SSR) so when search engines visit your site, metadata elements are already in the HTML returned by the server. You start adding nice <meta name="description">
to describe your home page. Then Open Graph metadata like <meta property="og:title">
to customize social cards / link previews. You use Angular's Meta
APIs to insert those in your DOM. All good so far π
Now, you want to set metadata for another page of your site π€
Calls to Angular Meta
APIs start appearing in many places around. Object literals specifying <meta>
definitions breed like rabbits π You also have to ensure when changing pages that metadata from a page doesn't stay there when visiting another. It's all starting to be a bit tedious π
If only there was a way to easily specify metadata I want for each page in a declarative fashion and forget about it π You're in the right place then π This library will definitely help you π₯³
πΊοΈ Start exploring
New users
First, welcome π₯°
Wondering why this library and not another one? Take a look at why section. Probably most interesting parts are features and comparison pages.
For the hands-on devs (this is the way), get started now β‘οΈ
Existing users
Take a look at guides to refresh your knowledge. Like the one about setting metadata programmatically using the service, in a declarative fashion using route's data. Or how metadata values JSON is shaped.
Go deeper by:
- Setting default metadata values for all pages
- Setting up URL resolution to use relative URLs but get absolute URLs as metadata values
- Loading metadata later to reduce main bundle size
- Providing your custom metadata managers
- Fine-grained choosing metadata elements you're interested in. Rest of them won't end up in your bundle
Are you by any chance looking for the API reference?