• Resolved luigitec

    (@luigitec)


    Hello Awesome Timber Team,

    Everything was going well with the Timber library until today, I’m working on a custom Google AMP implementation. I intend to get a pretty link for my AMP pages:

    https://domain.com/amp/2016/09/09/my-slug/

    But I can’t register the rewrite rule.

    https://domain.com/2016/09/09/my-slug/ works fine, but not the AMP one, to do so, I was using the Rewrite API But it keeps returning a 404 page.

    I also tried a plugin called “Rewrite” but it doesn’t work either. I read about the the Routes method integrated on the Timber library but it’s not working either. Since my implementation calls the desired views on my functions.php file:

    
    /* Starting AMP Variable: I intend to update it in order to get the query_var amp instead*/
    $amp = isset($_REQUEST['amp']) ? true : false;
    Timber::$dirname = get_views($amp);
    
    function get_views($amp)
    {
    
        $available_views = array(get_theme_instance()->views_folder);
    
        if ($amp) {
            $amp_view = get_theme_instance()->views_folder . "/amp";
            array_unshift($available_views,  $amp_view);
        }
    
        return $available_views;
    }
    

    So the Routes method isn’t working, could you guys help me figuring this out?

    Thanks in advance!

    • This topic was modified 8 years, 2 months ago by luigitec.
  • The topic ‘AMP rewrite rule’ is closed to new replies.