skip to Main Content

i have my website in react java. it was built very earlier. now i am trying to do SEO for my website, but i cannot give a separate SEO title and description for each page. even if i enter the syntax, google is not recognizing it. as, when i click "View Source" for any pages, it opens only the view source of the home page. no other pages are showing in the view source.

when i ask this with some tech persons, he is saying like, the entire website is built like a single landing page, so it will be like that only.

if so, how others can do SEO for their websites?.

is there any solution to solve this issue?

3

Answers


  1. Try react-meta-tags npm library to add meta tags in every component as you want

    npm install react-meta-tags --save
    

    Lets import react and react-meta-tags at first

    import React from 'react';
    import MetaTags from 'react-meta-tags';
    
    //lets make a componet having some meta tags structure like this
    class Component1 extends React.Component {
      render() {
        return (
            <div className="wrapper">
              <MetaTags>
                <title>Page 1</title>
                <meta name="description" content="Some description." />
                <meta property="og:title" content="MyApp" />
                <meta property="og:image" content="path/to/image.jpg" />
              </MetaTags>
              <div className="content"> Some Content </div>
            </div>
          )
      }
    }
    

    At First you should try This:-
    for react or simple html site the procedure is same
    In your public directory > index.html inside modify them

    for title
    To Give Title We should Add Our tile in between <title> my title </title> Tag

    for description
    add this tag between

    <meta name=”description” content=”This is my site description”>
    
    Login or Signup to reply.
  2. It all depends on what youve created etc.. however adding metadata on your page can be done easily using https://www.npmjs.com/package/react-helmet

    If you want pages to be indexable by a search engine, you will need to have a SPA mode and you will also need to render the page using SSR (static site rendering). Otherwise, the Google crawler won’t be able to read it

    If you are NextJS or some framework like then it’s easy.

    Login or Signup to reply.
  3. I had a similar problem with a site built in AngularJS.

    To solve the problem we create a pre-render service using this lib.

    We routed the crawler traffic to the pre-render service.

    If done correctly, google & other crawlers will always get fully rendered pages side stepping the SPA issue.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search