|
| 1 | +# Docs: https://squidfunk.github.io/mkdocs-material/setup/setting-up-social-cards/#customization |
| 2 | +# Partially inspired by: https://github.com/squidfunk/mkdocs-material/blob/master/src/plugins/social/templates/default/variant.yml |
| 3 | + |
| 4 | +definitions: |
| 5 | + # Background color |
| 6 | + - &background_color >- |
| 7 | + {{ layout.background_color }} |
| 8 | + |
| 9 | + # Text color |
| 10 | + - &color >- |
| 11 | + white |
| 12 | + |
| 13 | + # Font family (default: Roboto) |
| 14 | + - &font_family >- |
| 15 | + {%- if layout.font_family -%} |
| 16 | + {{ layout.font_family }} |
| 17 | + {%- elif config.theme.font is mapping -%} |
| 18 | + {{ config.theme.font.get("text", "Roboto") }} |
| 19 | + {%- else -%} |
| 20 | + Roboto |
| 21 | + {%- endif -%} |
| 22 | + |
| 23 | + # Font variant |
| 24 | + - &font_variant >- |
| 25 | + {%- if layout.font_variant -%} |
| 26 | + {{ layout.font_variant }} |
| 27 | + {%- endif -%} |
| 28 | + |
| 29 | + # Site description |
| 30 | + - &site_name >- |
| 31 | + {{ config.site_name }} |
| 32 | + |
| 33 | + # Page title |
| 34 | + - &page_title >- |
| 35 | + {{ page.meta.get("title", page.title) }} |
| 36 | + |
| 37 | + # Page title with site name |
| 38 | + - &page_title_with_site_name >- |
| 39 | + {%- if not page.is_homepage -%} |
| 40 | + {{ page.meta.get("title", page.title) }} - {{ config.site_name }} |
| 41 | + {%- else -%} |
| 42 | + {{ config.site_name }} |
| 43 | + {%- endif -%} |
| 44 | + |
| 45 | + - &page_description >- |
| 46 | + {%- if layout.description -%} |
| 47 | + {{ layout.description }} |
| 48 | + {%- else -%} |
| 49 | + {{ page.meta.get("description", config.site_description) | x }} |
| 50 | + {%- endif -%} |
| 51 | + |
| 52 | + |
| 53 | +# Meta tags |
| 54 | +tags: |
| 55 | + |
| 56 | + # Open Graph |
| 57 | + og:type: website |
| 58 | + og:title: *page_title_with_site_name |
| 59 | + og:description: *page_description |
| 60 | + og:image: "{{ image.url }}" |
| 61 | + og:image:type: "{{ image.type }}" |
| 62 | + og:image:width: "{{ image.width }}" |
| 63 | + og:image:height: "{{ image.height }}" |
| 64 | + og:url: "{{ page.canonical_url }}" |
| 65 | + |
| 66 | + # Twitter |
| 67 | + twitter:card: summary_large_image |
| 68 | + twitter:title: *page_title_with_site_name |
| 69 | + twitter:description: *page_description |
| 70 | + twitter:image: "{{ image.url }}" |
| 71 | + |
| 72 | + |
| 73 | +size: { width: 1200, height: 630 } |
| 74 | +layers: |
| 75 | + # Background color |
| 76 | + - background: |
| 77 | + color: *background_color |
| 78 | + # Circles for fancier background |
| 79 | + - size: { width: 2400, height: 2400 } |
| 80 | + offset: { x: -1024, y: 64 } |
| 81 | + icon: |
| 82 | + value: material/circle |
| 83 | + color: "#5c6bc0" |
| 84 | + - size: { width: 1800, height: 1800 } |
| 85 | + offset: { x: 512, y: -1024 } |
| 86 | + icon: |
| 87 | + value: material/circle |
| 88 | + color: "#3949ab" |
| 89 | + # Logo |
| 90 | + - size: { width: 64, height: 64 } |
| 91 | + offset: { x: 64, y: 64 } |
| 92 | + icon: |
| 93 | + value: fontawesome/solid/code |
| 94 | + color: white |
| 95 | + # Site name |
| 96 | + - size: { width: 768, height: 42 } |
| 97 | + offset: { x: 160, y: 74 } |
| 98 | + typography: |
| 99 | + content: *site_name |
| 100 | + color: *color |
| 101 | + font: |
| 102 | + family: *font_family |
| 103 | + variant: *font_variant |
| 104 | + style: Bold |
| 105 | + # Page title |
| 106 | + - size: { width: 885, height: 256 } |
| 107 | + offset: { x: 62, y: 192 } |
| 108 | + typography: |
| 109 | + content: *page_title |
| 110 | + overflow: shrink |
| 111 | + align: start |
| 112 | + color: *color |
| 113 | + line: |
| 114 | + amount: 3 |
| 115 | + height: 1.25 |
| 116 | + font: |
| 117 | + family: *font_family |
| 118 | + variant: *font_variant |
| 119 | + style: Bold |
| 120 | + # Page description |
| 121 | + - size: { width: 885, height: 64 } |
| 122 | + offset: { x: 64, y: 512 } |
| 123 | + typography: |
| 124 | + content: *page_description |
| 125 | + align: start |
| 126 | + color: *color |
| 127 | + line: |
| 128 | + amount: 2 |
| 129 | + height: 1.5 |
| 130 | + font: |
| 131 | + family: *font_family |
| 132 | + variant: *font_variant |
| 133 | + style: Regular |
0 commit comments