Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wp_title in base.twig #284

Closed
JakubSzajna opened this issue Oct 10, 2017 · 4 comments
Closed

Fix wp_title in base.twig #284

JakubSzajna opened this issue Oct 10, 2017 · 4 comments
Assignees

Comments

@JakubSzajna
Copy link
Contributor

I've encountered the problem that in example Yoast SEO plugin overwrites page title via hook, so writing {{ wp_title }} - {{ site.name }} or just {{ site.name }} can be problematic, as you cannot predict what settings does user have and if it does not duplicate the site name in example.

And I believe the plugin is even printing site title and site description via wp_head action, so not only the content is duplicated, but the whole <title> occurs two times.

Maybe we should somehow warn developers of that behaviour?

@luboskmetko
Copy link
Member

Encountered this as well with Yoast SEO. However, it only duplicates titles if the Force rewrite titles is enabled - https://wordpress.org/support/topic/where-is-force-rewrite-titles-2/. Need to check if default Chisel installation with Yoast SEO does that.

If so, we should probably add add_theme_support( 'title-tag' ); and then just do in base.twig

{% if wp_title %}
  {{ wp_title }}
{% else %}
  {{ site.name }}
{% endif %}

@luboskmetko
Copy link
Member

Ok, in default installation Yoast SEO only adds site.name to the title but doesn't duplicate title element because Force rewrite titles is disabled by default

@jakub300
Copy link
Collaborator

I'm for the add_theme_support( 'title-tag' );, but it's my understanding that it is replacement to wp_title() and they should not be used together.

@luboskmetko
Copy link
Member

@jakub300 you're right, if we use it we need to remove the title tag. I'll try to send a PR in conjunction with #281

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants