question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SSG AMP hybrid mode dynamic route adds "amp":1 to context on build in non AMP article.json

See original GitHub issue

Bug report

Describe the bug

When using a dynamic route in hybrid mode with getStaticProps and getStaticPaths, all static generated files have added amp: 1 to context.

E.g if getStaticPaths returns /article for [slug].js then these files are generated:

article.amp.html
article.amp.json
article.html
article.json

and in article.json context is

context: { 
  params: {
    slug : ["article"],
    amp: 1
  }
}

So first visit on article loads AMP component . Everything goes back to normal once revalidated.

To Reproduce

https://github.com/SuperdeskWebPublisher/publisher-pwa

  • download repository.
  • build
  • go to .next/server/pages/business/WHATEVER.json and look for context (value of context.params is added to pageProps)

Expected behavior

Article.json context should not contain amp: 1

System information

  • OS: macOS
  • Version of Next.js: 9.5.5
  • Version of Node.js: 10.15.0

Additional context

this may be connected: #17245

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
tomaszrondiocommented, Oct 26, 2020

I believe that sooner or later there will be a case when someone will really need to know if isAmp at the level of getStaticProps. But yeah so far so good 😃

0reactions
balazsorban44commented, Jan 29, 2022

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make your pages discoverable - amp.dev
Make your pages discoverable. In some cases, you might want to have both a non-AMP and an AMP version of the same page,...
Read more >
How to add AMP to Django Project? - GeeksforGeeks
We will add AMP for speed. This article is in continuation of Blog CMS Project in Django. Check this out here – Building...
Read more >
Google AMP (1.0.3) - Snowplow Documentation
In order to function, this requires that linkers are enabled in the amp-analytics configuration. Not doing so can result in changing AMP client ......
Read more >
What is Google AMP? How does it affect Google Search?
AMP pages load quicker, boost performance and engage the audience. ... AMP websites, AMP stories, AMP ads, and AMP mail serve our needs...
Read more >
AMP Integration with Sitecore
Create AMP specific device layout to separate AMP and Non-AMP page and ... href="http://example.ampproject.org/article-metadata.html"> <meta ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found