Is it possible to send isAmp from server to client conditionally? (valid usecase) #16597
Unanswered
omar-dulaimi
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
UPDATE:
I'll rephrase my question since it's not clear enough.
What I want to accomplish here is pass isAmp from getInitialProps to the component to control whether it'll be amp or a regular one.
Why I want to do that?
Because I want to make some client operations if the page is loading a deleted item; since amp is all done on the server, I can't use react hooks nor redirect the page after 10 seconds.
Hope this explains better.
Also hybrid mode makes the non-amp page the default unless I append the ?amp=1 to the uri. In my case I want to maintain the default as AMP but control when to show the non-amp version of it.
Hello,
I have an an amp page that I want to turn it into a regular page when the item status is deleted so I can use the client side to redirect the user after 10seconds.
To make a page amp, we just add this export at the top of the file
export const config = { amp: true };
The mode I'm interested in is the 'hybrid' mode.
Is there a way to pass the isAmp value through the server and then to the client like this next hook does
const isAmp = useAmp();
I want the value passed right to the first line of code above:
export const config = { amp: isAmp };
Am I making sense?
I'm going through this process in order to make client side code work, like redirecting the page to another url. Which only works on non-amp pages.
Beta Was this translation helpful? Give feedback.
All reactions