Skip to content

[API]: Add primary headings to Docs search responses #761

Description

@AugustMiller

Product

Other/Multiple/Not Sure

Description

Documentation API search queries should include the top-level headings (often called the "table of contents" in Markdown parsers) with anchors and/or fully-formed direct URLs (as seen under the proposed headings key):

{
    "id": 826167,
    "title": "Application Configuration",
    "url": "https://craftcms.com/docs/5.x/reference/config/app",
    "uri": "docs/5.x/reference/config/app",
    "slug": "app",
    "type": "Craft CMS 5.x / Reference / Configuration Reference",
    "summaryPlain": "Craft’s entire application configuration can be customized via config/app.php. Any items returned by an app.php config file will get merged into the main application configuration array.",
    "summaryHtml": "Craft’s entire <a href=\"guide:structure-applications#application-configurations\">application configuration</a> can be customized via <code>config/app.php</code>. Any items returned by an <code>app.php</code> config file will get merged into the main application configuration array.",
    "headings": [
        { "level": 2, "name": "approach", "text": "Approach", "url": "https://craftcms.com/docs/5.x/reference/config/app#approach" },
        { "level": 2, "name": "requests-responses", "text": "Requests + Responses", "url": "https://craftcms.com/docs/5.x/reference/config/app#requests-responses" },
        { "level": 3, "name": "cors", "text": "CORS", "url": "https://craftcms.com/docs/5.x/reference/config/app#cors" }
    ]
}

We are currently testing the Heading Permalinks extension, and should be able to capture or generate all of this, as the text is rendered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions