Giter Club home page Giter Club logo

react-dynamic-meta-tags's Introduction

Adding dynamic meta tags to a React app without SSR

Support repository for "Adding dynamic meta tags to a React app without SSR" tutorial. A simple and effective solution to inject dynamic meta tags in a React app without SSR.

This project was bootstrapped with Create React App.

The problem

If you want to set up dynamic meta tags based on different URLs in your project (e.g. /home, /about, /detail?id=1, /detail?id=2), you have to do it server-side. Web crawlers don’t always execute JavaScript code when examining a webpage, so if you want to make sure that they read your meta tags, you need to set them up before the browser receives the page. But what if I don’t have server-side-rendering (SSR) for my app?

The solution

The article shows how to serve the app from a Node/Express backend to inject the meta tags before returning the HTML page to the client.

Run the project

In the project directory, you can run:

npm run server

Builds the app for production and start the server on port 3000.

You can see how meta tags changes based on the requested URL, e.g. http://localhost:3000/post?id=1, http://localhost:3000/post?id=2

react-dynamic-meta-tags's People

Contributors

angelofaella avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.