Adding Meta Description to Custom Page Template
-
Hello,
I am using WordPress v4.6.1 and the Organic Music Theme and have created custom templates and assigned them to various pages. I would like to add custom meta data to these templates to improve their SEO. I have installed Yoast SEO plugin version 3.4.2. When I view the HTML of any template the <meta> section displays the following Yoast message:<!-- This site is optimized with the Yoast SEO plugin v3.6.1 - https://yoast.com/wordpress/plugins/seo/ --> <!-- Admin only notice: this page doesn't show a meta description because it doesn't have one, either write it for this page specifically or go into the SEO -> Titles menu and set up a template. -->
When I visit Admin > SEO > Titles and Meta > Post Types tab I do not see the new Templates listed – only post types and native templates pre-existing in the theme.
I have searched the web for help and found this wordpress meta api. Using this instruction I added the following code to file themes/My_Theme/functions.php to see if I could get any meta information into the templates:
add_filter( 'wpseo_metakey', 'yoast_add_keywords', 10, 1 ); function yoast_add_keywords( $str ) { return $str.',yoast'; }
However, when I view the HTML with this snippet added the Yoast comment persists. Can someone tell me the best/simplest way to add meta information to the <head> sections of my custom templates?
Thanks so much,
Robbie
- The topic ‘Adding Meta Description to Custom Page Template’ is closed to new replies.