- This topic has 6 replies, 2 voices, and was last updated 3 years, 10 months ago by
David.
-
AuthorPosts
-
January 12, 2020 at 5:31 am #1129536
Matthew
I use an element to display my H1 on certain pages. In the element, I use {{post_title}} to display the H1. But I’ve recently changed and I want to use a shortcode to display the header (ex., [shortcode]) which will call back to a function where I can modify the header on the fly.
The problem I’m running into is when I switch from {{post_title}} to [shortcode], GeneratePress will display my H1 a second time, and place it inside <header>. I know I could just hide that in CSS, but I’m wondering how I would get treated from like a keyword stuffing standpoint. Maybe I won’t, but I don’t know. So ideally, I want to know if there is a way to just disable the <header> content altogether from generating? At the moment, when I use {{post_title}}, nothing is in the <header> anyway.
January 12, 2020 at 6:41 am #1129590David
StaffCustomer SupportHi there,
you can use the Layout Element to disable the Content Title:
https://docs.generatepress.com/article/layout-element-overview/#disable-element
January 12, 2020 at 7:01 am #1129753Matthew
I tried that but that seems to disable to top header. Not the actual <header> in the body.
January 12, 2020 at 7:12 am #1129761David
StaffCustomer SupportCan you provide a link to the site so we can take a look at whats going on?
You can edit your original topic and use the Site URL field to share the link privately.January 12, 2020 at 8:49 am #1129796Matthew
I added the URL so you can see but because my site is live and has over a hundred pages, I have a “display: none” on the entry-header class.
Here is the issue again. I use an element to display my H1 inside my page-hero as such:
<div class="tl-header"> <h1>{{post_title}}</h1> </div>
But I want to dynamically adjust the content of the title so I altered the element to use a shortcode:
<div class="tl-header"> <h1>[tlTitle]</h1> </div>
But when I do that, GeneratePress creates a second <h1> inside the entry-header class and I effectively have two H1s… a first inside my page-hero (which is what I want) and a second inside my entry-header (which I don’t want).
Odd part? It ONLY does this when I use a shortcode instead of using the {{post_title}}
TLDR: I want to GeneratePress to stop putting an H1 in this section when I use a shortcode:
<header class="entry-header"><h1 class="entry-title" itemprop="headline">xxxxxxxxxxxxxx</h1><div class="entry-meta"></div><!-- .entry-meta --></header>
January 12, 2020 at 9:19 am #1129823Matthew
I got it fixed. I just enabled the box that says disable “Content Title” in the layout. I thought I tried that before, but I guess I didn’t. Thanks for looking into it.
January 13, 2020 at 4:48 am #1130388David
StaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.