• Resolved yartenaey

    (@yartenaey)


    Hi,

    Is it possible to have the automatic generated meta description come from the main post content instead of the short description?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hello!

    Sorry for the late reply 🙁

    This is the first time someone asks about this in 4 years! I’m afraid we don’t have an easy toggle for this, but you can override its behavior if you so desire.

    It’ll look a bit like in the gist below, but I don’t recommend implementing it, for you’ll need to maintain it yourself. Moreover, regarding performance, you’ll be better off writing a custom description. In either case, Google can choose to ignore the description meta tag and generate another one for you.
    https://gist.github.com/sybrew/5fac0d3db62136b70d40c8e997dfea09

    Thread Starter yartenaey

    (@yartenaey)

    Hi,

    My turn for the delayed reply :/

    I had searched thinking surely it must have been asked before, but there you go!

    The reason for wanting to do this is my product short descriptions have shortcodes to list product attributes. I tried the snippets I could find to make shortcodes run in the description but I couldn’t get them to work. I have 10,000+ products so writing a custom description is not an option and the import plugin I use to make updates doesn’t write to TSF fields. I thought perhaps there would be an easy toggle, but alas!

    Plugin Author Sybre Waaijer

    (@cybr)

    Hello!

    Using shortcodes in excerpts is also new to me, so that’s probably why you haven’t found a working filter snippet.

    This snippet should do:

    add_filter( 'the_seo_framework_fetched_description_excerpt', 'apply_shortcodes' );
    

    Mind though that this might affect performance when the shortcodes are generously used throughout your content and excerpts: The filter parses all content fetched, not just the first few hundred characters — it trims the result.

    If that filter leaves you with weird descriptions, let me know, and I’ll forward you a more scrupulous one.

    Thread Starter yartenaey

    (@yartenaey)

    Alas that snippet did not load the shortcodes for me in the descriptions?

    Plugin Author Sybre Waaijer

    (@cybr)

    Hello!

    Sorry for getting back to you this late.

    That could mean that the shortcode is registered too late for TSF to process it. Do you have the PHP code (and the caller of the code) of the shortcode for me? You can share it via a service such as https://pastebin.com/.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Auto Generated Meta Description from Content not Excerpt’ is closed to new replies.