Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more JSON-LD types to Docs #52

Open
3 tasks
Burhan-Q opened this issue May 20, 2024 · 0 comments
Open
3 tasks

Add more JSON-LD types to Docs #52

Burhan-Q opened this issue May 20, 2024 · 0 comments

Comments

@Burhan-Q
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant