Hi @casbboy,
Thanks for bringing this up. I also saw that issue.
It might be that we need to change the plugin to use home_url( '/' )
instead of home_url()
:
https://github.com/Automattic/amp-wp/blob/c65cbf85d0110620c0fcb29c3db12348f2aa1df3/includes/templates/class-amp-post-template.php#L116
It looks like the default use of that function is:
<?php echo esc_url( home_url( '/' ) ); ?>
I’ll let you know about this, and feel free to also ping me on this topic.
Workaround
In the meantime, here’s a workaround to add the trailing slash. You can add this to a theme or plugin:
/**
* Ensure the home url has a trailing slash.
*
* @param array $data The AMP post template data.
* @return array $data The filtered AMP post template data.
*/
add_filter( 'amp_post_template_data', function( $data ) {
if ( isset( $data['home_url'] ) ) {
$data['home_url'] = home_url( '/' );
}
return $data;
} );
Here’s the GitHub issue, in case you’d like to see the status of a possible fix:
https://github.com/Automattic/amp-wp/issues/1158
Hi @casbboy,
Sure, we’re planning on releasing the fix from the GitHub PR above as part of 0.7.1
this coming week.