npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@acpaas-ui/ngx-context

v6.0.6

Published

This package manages meta tags and other SEO properties.

Downloads

62

Readme

@acpaas-ui/ngx-context

This package manages meta tags and other SEO properties.

Usage

import { ContextModule, ContextService } from '@acpaas-ui/ngx-context';

Documentation

Visit our documentation site for full how-to docs and guidelines

Different ways to set tags and other SEO properties.

Set defaults

You can set defaults and other options for the module by using the forRoot() option in the import section:

API

| Name | Default value | Description | | ----------- | ------ | -------------------------- | | useTitleSuffix: boolean; | false | Add an optional title suffix. | | extendTitle: boolean; | false | Append parent page titles (when using router context). | | titleDelimiter: string; | '|' | The separator to use when extendTitle is true. | | defaults: Context; | {} | Default values for the meta tags. Have a look at the list down below for an overview of possible tags. | | routerContext: boolean; | true | Listen for meta data on the route changes. |

Example

@NgModule({
    imports: [
        ContextModule.forRoot({
            useTitleSuffix: true,
            extendTitle: true,
            titleDelimiter: ' | ',
            defaults: {
                titleSuffix: 'Context Module',
            },
            routerContext: true,
        }),
    ]
})
Set tags on routes

You can set tags on routes using the data property. The ContextService will subscribe to the router and pick up these tags automatically.

export const CONTEXT_EXAMPLES_ROUTES: Routes = [
    {
        path: '',
        component: ContextDemoPageComponent,
        pathMatch: 'full',
        data: {
            meta: {
                page: 'Context example page',
                title: 'Context',
                description: 'Description of the context example page',
                metatags: 'Antwerp UI, Angular, context',
            },
        },
    },
];
Set tags on routes

You can set tags manually in your components using the loadContext method as well. This is useful for async data or generic routes.

import { ContextService } from '@acpaas-ui/ngx-context';

@Component({
    providers: [
        ContextService,
    ],
})

export class ContextDemoPageComponent {
    constructor(private contextService: ContextService) {}

    public setTitle() {
        this.contextService.updateContext({
            title: 'New context example title',
        });
    }
}
<button class="a-button" (click)="setTitle()">Set title</button>

Default available tags

The most used tags are available in the Context interface. You are however, free to use whichever tag you need in the format [key: string]: string;.

  • title
  • titleSuffix
  • description
  • favIcon
  • og:url
  • og:type
  • og:title
  • og:description
  • og:image
  • fb:app_id
  • og:locale
  • og:locale:alternate
  • og:see_also
  • og:updated_time
  • twitter:card
  • twitter:site
  • twitter:creator

Contributing

Visit our Contribution Guidelines for more information on how to contribute.