• Resolved codade

    (@codade)


    Hi,

    I just installed Rank math and tried to get my toc recognised, which is generated by a shortcode-function. This function also reads headings generated through other shortcodes from the post and outputs a html-div with its own id and class, similar to the rank-math-toc. I found your page about TOC and the code snippet to register other TOC plugins. Is there also a way to tell your plugin, that it should use the contents or what kind of information and in what format (json/html) is needed to get the info of the TOC into the schema?

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @codade,

    Rank Math doesn’t automatically enable SiteNavigationElement schema for custom TOCs. However, you can customize our schema using this filter: https://rankmath.com/kb/filters-hooks-api-developer/#extend-json-ld-data

    If you’re using Rank Math PRO, you can manually create the JSON format and import it via our schema importing tool. Here’s an example structure:

    {
    "itemListElement": [
    {
    "@context": "https://schema.org",
    "@type": "SiteNavigationElement",
    "@id": "#rank-math-toc",
    "name": "I. Introduction",
    "url": "http://rm-pro.local/why-computers-arent-perfect/#i-introduction"
    },
    {
    "@context": "https://schema.org",
    "@type": "SiteNavigationElement",
    "@id": "#rank-math-toc",
    "name": "II. Historical Context of Computer Development",
    "url": "http://rm-pro.local/why-computers-arent-perfect/#ii-historical-context-of-computer-development"
    },
    {
    "@context": "https://schema.org",
    "@type": "SiteNavigationElement",
    "@id": "#rank-math-toc",
    "name": "A. Early Innovations and Limitations",
    "url": "http://rm-pro.local/why-computers-arent-perfect/#a-early-innovations-and-limitations"
    },
    {
    "@context": "https://schema.org",
    "@type": "SiteNavigationElement",
    "@id": "#rank-math-toc",
    "name": "B. Evolution of Computing Technology",
    "url": "http://rm-pro.local/why-computers-arent-perfect/#b-evolution-of-computing-technology"
    },

    ...etc
    ]
    }

    Here’s a guide you can follow: https://rankmath.com/kb/import-schema-markup/

    Hope that helps.

    Thread Starter codade

    (@codade)

    Thank you for your help!

    The filter to extend the existing json-ld was the thing I was searching for and I was able to get my TOC working with your plugin.

    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @codade,
     
    You’re very welcome! Glad to hear you got it working. If you need any further assistance, feel free to reach out.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Register shortcode generating TOC’ is closed to new replies.