Skip to content

Add meta Tag dynamically  #25

@arukumar

Description

@arukumar

Hi,
can you please explain, how to add meta tag dynamically in server side rending. I have written something like

import React, { Component, PropTypes } from 'react'
import { defineMessages, FormattedMessage } from 'react-intl'
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import DocumentMeta from 'react-document-meta';

export default class metaTag extends React.Component {
    render() {
        const meta = {
            title: 'Some Meta Title',
            description: 'I am a description, and I can create multiple tags',
            canonical: 'http://example.com/path/to/page',
            meta: {
                charSet: 'utf-8',
                name: {
                    keywords: 'react,meta,document,html,tags'
                },
                itemProp: {
                    name: 'The Name or Title Here',
                    description: 'This is the page description',
                    image: 'http://example.com/image.jpg'
                },
                property: {
                    'og:title': 'I am overriding!',
                    'og:type': 'article',
                    'og:image': 'http://example.com/image.jpg',
                    'og:site_name': 'Example Site Name',
                    'og:price:amount': '19.50',
                    'og:price:currency': 'USD',
                    'twitter:site': '@site',
                    'twitter:title': 'I am a Twitter title'
                }
            },
            auto: {
                ograph: true
            }
        };


        return (
            <div>
                <DocumentMeta {...meta} >
                <h2> Check Server side </h2>
            </div>
        );

    }
}

but how to add them to sever.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions