Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Hey @optimanovasolutions
    Thank you so much for using the plugin ??

    We are planning to release an update today which will have a feature to setup a frontpage for the AMP version.

    Regards,
    Ahmed

    Thread Starter Optimanova

    (@optimanovasolutions)

    Hi @ahmedkaludi,

    Thanks so much, for the new update ??

    I have a new issue in the front page, in this case, I have enabled the Custom Front Page Option and if you check the home page (desktop version) this tag appears twice:

    <link rel=”amphtml” href=”https://www.optimanova.com/es/?amp&#8221; />
    <link rel=”amphtml” href=”https://www.optimanova.com/es/amp/&#8221; />

    I have updated the permalinks and I have the same problem,

    Thanking you in advance for your assistance,

    Kind regards

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    I have checked your source code and I don’t see two different link rel options?

    Thread Starter Optimanova

    (@optimanovasolutions)

    Hi Ahmed,

    Yes, It’s a cache problem, I have refreshed the cache and now you can see the rel=”amphtml” twice in the source code.

    view-source:https://www.optimanova.com/

    On the other hand, for your information, in the front page I have another issues with the AMP Validator. In this case, if you check the file:

    accelerated-mobile-pages/templates/frontpage.php

    It generates the whole content and It does not replace the invalid html tags, for example (<img, <iframe) and attributes (style=””, etc):

    <?php the_content(); ?>

    In this case, I have created a patch for our homepage and it works perfectly:

    You only need to replace the last line with this:

    <?php 
    	# Replace attributes style
    	$content = preg_replace('/(<[^>]+) style=".*?"/i', '$1', do_shortcode(get_the_content()) );
    	
    	# Replace img with amp-img tag
    	$html = str_ireplace(
    		'<img',
    		'<amp-img',
    		$content
    	);
    
    	# Add closing tags to amp-img
    	$html = preg_replace('/<amp-img(.*?)>/', '<amp-img$1></amp-img>', $html);
    	
    	# Replace iframe tags with amp-iframe
    	$html = str_replace("iframe", "amp-iframe", $html);
    
    	echo $html; 
    
    ?>

    In this case, I have deleted styles attributes and I have replaced img and iframe tags,

    I hope this info can be useful for future updates,

    However, there are still several html tags that need replacing, e.g. video, etc.

    Thanking you in advance for your assistance,

    Kind regards

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Front Page issue’ is closed to new replies.