Bug report
Describe the bug
- When SSG with
fallback: true and amp: "hybrid" are used together, the paths not specified in getStaticPaths have an invalid href in <link rel="amphtml"> tag.
- For example, when there is a
pages/[slug].jsx and the user visits /bar, the <link rel="amphtml"> tag will refer to /[slug].amp.
To Reproduce
https://github.com/wawoon/next-amp-ssg-fallback-reproduce
pages/[slug]/index.jsx
export default (props) => {
return <div>slug: {props.slug}</div>;
};
export const config = {
amp: "hybrid",
};
export const getStaticProps = async (ctx) => {
return {
props: {
slug: ctx.params.slug,
},
};
};
export const getStaticPaths = async () => {
return { paths: [{ params: { slug: "foo" } }], fallback: true };
};
※ caution: When you add unstable_revalidate to getStaticProps, the href of <link rel="amphtml"> is overwritten while regeneration by #14251
When the user visits http://localhost:3000/bar, bar is not specified in getStaticPaths, the href of <link rel="amphtml"> refers to /[slug].amp. And this /[slug].amp is invalid url.

Expected behavior
- The
/bar should have correct amp page path, even when the path is not included in getStaticPaths.
- The amp version of
/bar should be generated using getStaticProps dynamically.
Screenshots
System information
- macOS
- Chrome
- Next: 9.4.5-canary.12
- Node: v12.14.1
Additional context
Bug report
Describe the bug
fallback: trueandamp: "hybrid"are used together, the paths not specified ingetStaticPathshave an invalid href in<link rel="amphtml">tag.pages/[slug].jsxand the user visits/bar, the<link rel="amphtml">tag will refer to/[slug].amp.To Reproduce
https://github.com/wawoon/next-amp-ssg-fallback-reproduce
pages/[slug]/index.jsx
※ caution: When you add
unstable_revalidateto getStaticProps, the href of<link rel="amphtml">is overwritten while regeneration by #14251When the user visits
http://localhost:3000/bar,baris not specified ingetStaticPaths, the href of<link rel="amphtml">refers to/[slug].amp. And this/[slug].ampis invalid url.Expected behavior
/barshould have correct amp page path, even when the path is not included ingetStaticPaths./barshould be generated usinggetStaticPropsdynamically.Screenshots
System information
Additional context
.ampwith?amp=1#14251 which is related with amp page with SSG.