Support » Plugin: ACF Content Analysis for Yoast SEO » Feature Request: Specify what fields are headings

  • pierrehooker

    (@pierrehooker)


    Hello, This is a great start to getting ACF into Yoast. The issue with the plugin though is that the content analysis is agnostic to the html output of the rendered custom fields.

    It would be great if there was some way to tell Yoast what ACF fields were headings and which headings they are so that could be used in the content analysis.

    Thanks for the great plugin!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Thomas Kräftner

    (@kraftner)

    This is actually possible right now (but enforces the fact that we need better documentation which we already have on our agenda)

    Have a look here for an example:
    https://angrycreative.se/en/open-source/acf-content-analysis-yoast-seo/#panel-8228-0-0-0

    pierrehooker

    (@pierrehooker)

    That is great news! Thanks for the info I will be implementing this asap.

    Just to wonder, do you know:

    We use ACF pro and flexible content fields to essentially make a very limited “page builder”. Because these blocks are rearrangeable we sometimes give some fields the ability to output an H1 or H2 depending on a ACF radio button selection. Is there a good way to deal with this using your filter?

    Thanks!

    pierrehooker

    (@pierrehooker)

    Also, can you define multiple headings in one filter, or does each need to be its own:

    Example:

    
    add_filter( 'yoast-acf-analysis/headlines', function ( $headlines ) {
        // value from 1-6, 1=h1, 6=h6
    headlines['field_591eb45f2be84'] = 2,
    headlines['field_591eb45f2be85'] = 2,
    headlines['field_591eb45f2be86'] = 3,
    headlines['field_591eb45f2be87'] = 3
    });
    Plugin Contributor Thomas Kräftner

    (@kraftner)

    As the definition what is which heading level happens on the server you can’t influence it with client side logic, sorry. This would require a way more complex client side logic which currently isn’t on our roadmap.

    Concerning your second question I am not sure if I understand it correctly. You need to change to field_591eb45f2be84 another field key but then you can mark multiple fields in one filter. Also I just noticed that the example has an error. So you’d need something like this:

    add_filter( 'yoast-acf-analysis/headlines', function ( $headlines ) {
        // value from 1-6, 1=h1, 6=h6
        $headlines['field_591eb45f2be86'] = 3
        $headlines['field_978w4rtgdstr7'] = 2
        return $headlines;
    });
    pierrehooker

    (@pierrehooker)

    Hi Thomas,

    Thanks for the help.

    I took your code example and addded my field keys, and I’m getting a 500 error. Do you see anything wrong with my syntax here:

    add_filter( 'yoast-acf-analysis/headlines', function ( $headlines ) {
        // value from 1-6, 1=h1, 6=h6
        $headlines['field_5936d9fc8952d'] = 2
        $headlines['field_59283d3b20950'] = 2
        $headlines['field_5935b5ae549cc'] = 2
        $headlines['field_592ee7fc48f6e'] = 2
        $headlines['field_59273b297895c'] = 2
        $headlines['field_5936bfa78d5e5'] = 2
        $headlines['field_5936c6ee90e80'] = 2
        $headlines['field_5936facfa293e'] = 2
        $headlines['field_592dd8c562dc8'] = 2
        $headlines['field_5936da698952f'] = 4
        $headlines['field_592f0023e25f2'] = 2
        $headlines['field_5995bf12ea6f7'] = 3
        return $headlines;
    });
    Plugin Contributor Thomas Kräftner

    (@kraftner)

    Ooops, simple mistake. The semicolon on the end is missing:

    add_filter( 'yoast-acf-analysis/headlines', function ( $headlines ) {
        // value from 1-6, 1=h1, 6=h6
        $headlines['field_5936d9fc8952d'] = 2;
        $headlines['field_59283d3b20950'] = 2;
        $headlines['field_5935b5ae549cc'] = 2;
        $headlines['field_592ee7fc48f6e'] = 2;
        $headlines['field_59273b297895c'] = 2;
        $headlines['field_5936bfa78d5e5'] = 2;
        $headlines['field_5936c6ee90e80'] = 2;
        $headlines['field_5936facfa293e'] = 2;
        $headlines['field_592dd8c562dc8'] = 2;
        $headlines['field_5936da698952f'] = 4;
        $headlines['field_592f0023e25f2'] = 2;
        $headlines['field_5995bf12ea6f7'] = 3;
        return $headlines;
    });
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Feature Request: Specify what fields are headings’ is closed to new replies.