2

I am using angular universal. This is the main url : https://domain-name.com/articles/some-article-slug-here

When this url is opened then res.render('index') is called and it causes to render the index.html file as shown in the code below.

app.get('*', (req, res) => { 
        res.render('index', { req });
  });

Content of index.html is shown below:

<!doctype html>
   <html lang="en">
       <head >
           ......some head data here.....
       </head>
           
       <body>
          ......some body data here......
       </body>
   </html>

I want that when url : https://domain-name.com/amp/articles/some-article-slug-here is opened then replace the whole content inside html tag with some another html as shown below:

<!doctype html>
    <html amp lang="en">
    <head >
        ......some another head data here.....
    </head>
    <body>
      ......some another body data here......
    </body>
   </html>
Nandan Pandey
  • 148
  • 1
  • 11

1 Answers1

0

Use Angular routing, you are saying: "I need a SPA with Angular!" https://angular.io/guide/router

RealSeik
  • 147
  • 1
  • 8
  • But as soon as the second url i.e. https://domain-name.com/amp/articles/some-article-slug-here is being hit then it does allow the tag present in the body – Nandan Pandey Feb 07 '21 at 15:09