Custom Page titles and SEO

We use a package called ‘helmet’ to set custom page titles and add meta tags on pages within our app.

Open the page component you wish to add custom page title and import the package

import { Helmet } from 'react-helmet';

Create a new method and define your page title and a custom body class

head() {
    return (
        <Helmet bodyAttributes={{ class: "myClassName" }}>
            <title>My new page title</title>
        </Helmet>
    );
}

Call this method anywhere within your return statement

render() {
return (
    <div className="grid pageHeaderSection">
        {this.head()} <<-- We are calling it here
        <div className="column column_12_12">
            <div className="content_wrap">
                <h2>Users</h2>
                <p className="desc">
                    Lorem Ipsum is simply dummy text…

Last updated