• Resolved joycegrace

    (@joycegrace)


    Hi,
    I’m seeing in this article, the markup for the FAQ block has an H2 heading for a title:

    https://developer.yoast.com/theming-gutenberg-the-faq-block/

    It also has

    But when I try to set up FAQs with the Yoast SEO blocks, my output is only using strong tags

    I searched this issue and found this forum that it seems to be a known issue:

    https://github.com/Yoast/wordpress-seo/issues/11802

    My question is:

    Since the H2 tag is on your article noted above, I’m curious if this was once included, and if there is a way to bring it back? With a code snippet perhaps? I couldn’t find anything by googling or searching this forum.

    If that’s not an option, my other question is: Also, like others in the forum, if I manually add the H2 tag, per the markup given in the article (same class and everything), the block wants to switch to HTML, and then it can no longer be edited as an FAQ, nor converted back to an FAQ block. If I use this method for now, will it convert to the ‘right’ way of setting up these FAQs later, when the Yoast SEO FAQ blocks are updated to include heading tags, as mentioned in the forum thread?

    Just worried we’ll have a bunch of HTML blocks at a point in time when we could be rather editing with Yoast FAQ blocks, which would be way easier. Wish there was an easy way to convert this HTML back to an FAQ, is what I’m saying…

    Or, do you think there could be some other solution that would work in the interim? Like for instance, keeping the H2 in a heading block above the FAQ block, but using “display:none” on the Yoast FAQ title, so it continues to form the schema tag, but without having the question text show up twice for front-end users? I mean, I know I can technically do this, but I’m curious if your plugin will have some other way to ‘switch back’ if we do these temporary measures to ensure H2 tags on our site? I guess that’s not the best option…

    Our entire site is written in the question / answer format. So this is really important – if we take out H2s to use the FAQ blocks, we will lose all the benefits of using keywords in heading tags, too. But we really want to get on this FAQ bandwagon (I know it’s not necessary to mark it up to show up in SERPs this way, but we still want to get ahead here and cover our bases).

    Side note: Also want to implement this https://codepen.io/abergin/pen/ihlDf – a CSS only accordion (also mentioned on your site as a suggestion). But that may affect a lot if the div and html tags change later, yes? such as, if we try an interim method of getting an H2 in the FAQ block?

    Anyway… thinking out loud and hoping someone may know of a solution for the time being?

    Thanks!

    • This topic was modified 5 years, 2 months ago by joycegrace.
    • This topic was modified 5 years, 2 months ago by joycegrace.
Viewing 5 replies - 1 through 5 (of 5 total)
  • MariusG

    (@marius_codeinwp)

    Hi @joycegrace,

    The H2 tag in this markup was actually meant to be used for a title of the block, not for the questions (the questions are still in strong tags). It is not currently possible to use H2 tags for the questions in the FAQ block. I’ll forward this info to my colleagues in charge, that snippet does not match the output of the plugin in an FAQ block.

    If you do convert the blocks to HTML and edit the questions to H2 instead of strong, it’s unlikely that once we’ll add this feature they will convert back to FAQ blocks.

    Rather than using 2 types of Blocks (one hidden with CSS), if you need headings sooner, then you might want to convert them to HTML to make these changes and use the WordPress revisions for posts. You can revert back to the FAQ block using the revisions, once we add this feature to Yoast SEO.

    Unfortunately, we could not say for sure if the HTML tags will change and how. We couldn’t make a specific recommendation regarding the CSS for accordions on the FAQ Block. We don’t expect that many changes to happen, you should be safe to add the CSS and replace later strong to h2.

    Thread Starter joycegrace

    (@joycegrace)

    Hello Marius! Thank you for this very quick reply.

    Where do we enter the block title? I don’t seem to see that option for an H2 output. I also don’t see it in instructions… (if I’m blind and missed it, I apologize).

    Side note: I looked more into the CSS for the accordion method, but that would require setting up form checkboxes and such in the HTML output, and that would have been an mess as far as an ‘easy’ way to set that up for ‘dummy proof’ back-end editing (like if a client wanted to edit). So, I went back to a js plugin as a solution…

    It turns out, by accident, today I just happened to try entering a shortcode in the question field, which gave me the proper output of an H2, using the collapse-o-matic plugin.

    So for example, [expand title=”My amazing qustion?” tag=”h2″]

    And then adding [/expand] at the end of the question. It also did the expand/collapse accordion thing.

    Of course, the problem with doing that is that now the structured data name includes the shortcode characters, which won’t read nice on search results pages. Can’t imagine that will help ranking either… (it does validate though…)

    In case anyone is wondering, I am able to enter that shortcode into the answer itself and it appears fine as an h2 with expand/collapse, but still gives the problem of the shortcode showing up in the schema markup answer.

    Now, the above issue probably has to do with the fact I’m using a shortcode for the js, and not some other method… but still, it would be nice if the FAQ block could accept more common WP inputs, or more HTML options, at least.

    I’m also having a lot of trouble with formatting, such as adding list styles, bold text, or images within paragraphs. (I’ll write a separate post on this since it’s getting off topic).

    Any change I try to make by switching to HTML, renders that whole block no longer editable, and no longer able to convert back to an FAQ block. Even if I click on “resolve” after the fact and then “Convert to blocks” – it just goes back to an HTML block or a shortcode block. It doesn’t seem to ‘understand’ that this was the FAQ block formerly.

    If click the “undo” button in the Block Editor twice, after clicking to “resolve” and then “convert to blocks”, it goes back to the FAQ block, without my HTML changes of course.

    But leaving it as HTML is very difficult to make updates if a client wanted to do it, who does not know HTML.

    So I’m in a dilemma again.

    I also have revisions turned to 0, because I want to keep the database light. So right now I’m not sure how the revisions option can help me (I’m not able to try your method, but my guess is that in the interim, it would still be hard for the client to update, and would lose our later content changes if we went to an older revision that used the FAQ block).

    Anyway… I’m currently at a loss. This is a big toss up for us. Do we manually set up structured data and forgo the Yoast FAQ block method, or wait for the Yoast code to update the strong tag to an h2, or just use Yoast’s block and lose our heading tags… this is a really hard decision to make.

    Thank you for all your work in making this feature free for everyone, however.

    Thread Starter joycegrace

    (@joycegrace)

    Regarding this suggestion:

    If you do convert the blocks to HTML and edit the questions to H2 instead of strong, it’s unlikely that once we’ll add this feature they will convert back to FAQ blocks.

    I can confirm that switching the block to HTML removes all FAQ structured data in the code. However, clicking on it to edit as HTML, or using the code editor, then switching back to visual editor, and leaving it as is with invalid content does not remove the structured data in the source code of the page. One can then still use the code editor to view the ‘leftover’ code with “invalid” content to make changes. But it will never be a block again, for regular edits, if someone wanted to edit it that way.

    So switching to HTML doesn’t seem to work. The page will not be editable otherwise, while still maintaining structured data… which is of course, the intent of using the block in the first place.

    Anyway just thought I’d let you know. Maybe you already knew…

    @joycegrace Thanks for the reply! We’ve passed along what you found to our developers. At this time it is not possible to add an h2 title to those blocks unless you follow the method you described above or use CSS to make the changed.

    We have a feature request to add support for those headings. In the meantime, we suggest signing up for our newsletter as that is where we will announce product changes and updates. You can sign-up for it here https://yoast.com/newsletter/.

    Thread Starter joycegrace

    (@joycegrace)

    Thank you Pcosta88, it’s great to know we’re heard here.

    CSS would only change the text size and formatting, but not create the h2 tag which I needed, for general SEO purposes.

    Due to the other formatting needs I had (such as being able to add lists), I’ve since decided to use the following solution to create the structured data:

    https://saijogeorge.com/json-ld-schema-generator/faq/

    I then put the resulting code in a text editor to add my own, allowable HTML tags, which the above generator will not do (it adds line breaks for lists like the Yoast block does).

    This method will also allow me to modify the answers a little for the SERPs, as some are quite long before Google shows the ‘More’ link to take people to the website. Personally, I don’t like that. But our answers are many paragraphs long sometimes (that’s just us).

    In case anyone is wondering, the solution above would create a whole new ld+json tag, in addition to the one that the Yoast plugin creates. It must be entered on the page where the questions actually exist. I use a custom HTML block to do this. It doesn’t show the ld+json tag on the front end when you use a custom html block, if you’re worried about that.

    I had trouble with the code block, which caused my site to lose formatting (that could just be the site itself, and not a universal happenstance). So watch out for that.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘FAQ H2 tag in documentation but not block editor?’ is closed to new replies.