Skip to content

Add more JSON-LD types to Docs #52

@Burhan-Q

Description

@Burhan-Q

mkdocs/plugin/main.py

Lines 225 to 238 in 88026c8

# Check if LD+JSON is enabled and add structured data to the <head>
if self.config["add_json_ld"]:
ld_json_script = soup.new_tag("script", type="application/ld+json")
ld_json_content = {
"@context": "https://schema.org",
"@type": "Article",
"headline": page.title,
"image": [page.meta["image"]] if "image" in page.meta else [],
"datePublished": git_info["creation_date"],
"dateModified": git_info["last_modified_date"],
"author": [{"@type": "Organization", "name": "Ultralytics", "url": "https://ultralytics.com/"}],
}
ld_json_script.string = json.dumps(ld_json_content)
soup.head.append(ld_json_script)

Include additional JSON-LD types:

Base the type on the file location, as an example, if the file has dataset in the filename or filepath, it should be a Dataset type.

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