|
# 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.
mkdocs/plugin/main.py
Lines 225 to 238 in 88026c8
Include additional JSON-LD types:
Base the
typeon the file location, as an example, if the file hasdatasetin the filename or filepath, it should be a Dataset type.