Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

I'm building the AMP plugin

+4 votes
153 views
asked Feb 28 in Plugins by Aymane
Hi, I'm building the AMP plugin that would display AMP pages when the url ends with /amp.

I created a page module and trying to match the request with contain(/amp) in the URL.

I always get the native page rendred. How can I prioritize the amp over the native routing?
commented Feb 28 by pupi1985
What is your desired URL structure? Something like this?

site.com/activity => site.com/activity/amp
commented Mar 1 by Aymane
Sorry my bad. I was testing on strpos() true? and 0 is evaluated as False.
commented Mar 1 by pupi1985
As rule of thumb, never test with a double equal. Use triple equal so you should do strpos($string, $otherString) === false or strpos($string, $otherString) !== false
commented Mar 1 by Aymane
Thanks! I still have the issue. The plugin match_request() doesn't work on questions pages.
function match_request($request)
    {
        return true;
    }
Doesn't work on questions pages. Can you help?
commented Mar 1 by pupi1985
What is your desired URL structure? Something like this?

site.com/123/amp => site.com/123/amp
commented Mar 2 by Aymane
site.com/123/title of question => site.com/123/title of qestion/amp
commented May 22 by Ronlaw
Any news on this, Aymane?

Please log in or register to answer this question.

...