|
5 | 5 | <link rel="preload" href="{{ 'assets/fonts/GeistMono-Variable.woff2' | url }}" as="font" type="font/woff2" crossorigin> |
6 | 6 | <link rel="preload" href="{{ 'assets/fonts/GeistPixel-Square.woff2' | url }}" as="font" type="font/woff2" crossorigin> |
7 | 7 | <link rel="preload" href="{{ 'assets/fonts/GeistPixel-Circle.woff2' | url }}" as="font" type="font/woff2" crossorigin> |
| 8 | +{# |
| 9 | + Structured data (JSON-LD) for SEO. |
| 10 | + - Homepage gets WebSite + Organization schema (helps Google show sitelinks and knowledge panel). |
| 11 | + - All other pages get BreadcrumbList schema (helps Google show breadcrumb trails in results). |
| 12 | + Breadcrumb URLs are resolved via _find_leaf_url because MkDocs nav sections don't have |
| 13 | + their own URLs — we use the first descendant page's URL as a proxy. |
| 14 | + Dedup by title to collapse nav levels duplicated by plugins (e.g. the blog plugin nests |
| 15 | + "Blog" inside "Blog"). The current page is omitted when its title matches the last |
| 16 | + ancestor (e.g. /examples/ is both the "Examples" section index and the page itself). |
| 17 | +#} |
| 18 | +{% macro _find_leaf_url(nav_item) -%} |
| 19 | + {%- if nav_item.url -%} |
| 20 | + /{{ nav_item.url }} |
| 21 | + {%- elif nav_item.children -%} |
| 22 | + {{ _find_leaf_url(nav_item.children | first) }} |
| 23 | + {%- endif -%} |
| 24 | +{%- endmacro %} |
| 25 | +{% if page.is_homepage %} |
| 26 | +<script type="application/ld+json"> |
| 27 | +{ |
| 28 | + "@context": "https://schema.org", |
| 29 | + "@graph": [ |
| 30 | + { |
| 31 | + "@type": "WebSite", |
| 32 | + "name": "dstack", |
| 33 | + "url": "https://dstack.ai/" |
| 34 | + }, |
| 35 | + { |
| 36 | + "@type": "Organization", |
| 37 | + "name": "dstack", |
| 38 | + "url": "https://dstack.ai/", |
| 39 | + "logo": "https://dstack.ai/assets/images/dstack-logo-notext.svg", |
| 40 | + "sameAs": [ |
| 41 | + "https://github.com/dstackai/dstack", |
| 42 | + "https://discord.gg/u8SmfwPpMd", |
| 43 | + "https://x.com/dstackai", |
| 44 | + "https://www.linkedin.com/company/dstackai" |
| 45 | + ] |
| 46 | + } |
| 47 | + ] |
| 48 | +} |
| 49 | +</script> |
| 50 | +{% elif page.ancestors | length > 0 %} |
| 51 | +<script type="application/ld+json"> |
| 52 | +{ |
| 53 | + "@context": "https://schema.org", |
| 54 | + "@type": "BreadcrumbList", |
| 55 | + "itemListElement": [ |
| 56 | + { |
| 57 | + "@type": "ListItem", |
| 58 | + "position": 1, |
| 59 | + "name": "Home", |
| 60 | + "item": "https://dstack.ai/" |
| 61 | + } |
| 62 | + {%- set pos = namespace(val=2) -%} |
| 63 | + {%- set prev = namespace(title="") -%} |
| 64 | + {%- for ancestor in page.ancestors | reverse -%} |
| 65 | + {%- if ancestor.title != prev.title -%} |
| 66 | + ,{ |
| 67 | + "@type": "ListItem", |
| 68 | + "position": {{ pos.val }}, |
| 69 | + "name": "{{ ancestor.title | e }}", |
| 70 | + "item": "https://dstack.ai{{ _find_leaf_url(ancestor) | trim }}" |
| 71 | + } |
| 72 | + {%- set pos.val = pos.val + 1 -%} |
| 73 | + {%- endif -%} |
| 74 | + {%- set prev.title = ancestor.title -%} |
| 75 | + {%- endfor -%} |
| 76 | + {%- if page.title != prev.title -%} |
| 77 | + ,{ |
| 78 | + "@type": "ListItem", |
| 79 | + "position": {{ pos.val }}, |
| 80 | + "name": "{{ page.title | e }}" |
| 81 | + } |
| 82 | + {%- endif -%} |
| 83 | + ] |
| 84 | +} |
| 85 | +</script> |
| 86 | +{% endif %} |
8 | 87 | {% endblock %} |
9 | 88 |
|
10 | 89 | {% block container %} |
|
0 commit comments