Home  >  Q&A  >  body text

How to add amphtml and canonical links for dynamic page views

I followed this article and this article to optimize my Laravel website Google AMP. My website shows different views for different routes. For example, / will open the index page (after binding multiple views), while the /amp route will point to the amp version of the index page.

According to the AMP documentation, two pages should be linked to each other via canonical and amphtml links, like this:

<link rel="canonical" href="/article.html">
<link rel="amphtml" href="/article.amp.html">

Any ideas on providing these links for Laravel Blade since I don't have the complete .html page. Should I add a route here? For example

<link rel="canonical" href="{{/}}">
<link rel="amphtml" href="{{/amp}}">

P粉515066518P粉515066518229 days ago339

reply all(1)I'll reply

  • P粉668804228

    P粉6688042282024-03-28 12:42:54

    Generate amp pages and non-amp pages... copy the urls from the browser and insert these urls into both links accordingly

    reply
    0
  • Cancelreply