Update docs with new opengraph info

This commit is contained in:
checktheroads 2020-07-04 15:18:53 -07:00
parent ad26951a64
commit 3b0895f663
8 changed files with 29 additions and 33 deletions

View file

@ -66,13 +66,14 @@ If your organization's policy allows, and you don't mind, I request that you kee
If you're not familiar with [OpenGraph](https://ogp.me/), it's the thing that generates the pretty pictures, titles, and descriptions for links when you post them to sites/tools such as Facebook, Twitter, Slack, etc.
By default, no Opengraph image is set. If you define one with `image`, hyperglass will try to determine the image's dimensions automatically. Or, you can override those dimensions with the `width` and `height` parameters.
By default, [this Opengraph image](/opengraph.jpg) is set. If you define one with `image`, hyperglass will automatically generate an Opengraph image using the following methodology:
| Parameter | Type | Description |
| :-------- | :-----: | :---------------------- |
| `image` | String | Path to opengraph image |
| `width` | Integer | Opengraph image width |
| `height` | Integer | Opengraph image height |
- If the image is already 1200x630, it will be used
- If the image is or is not 1200x630, but contains transparency (like in a `.png` formatted image), it will be converted to a JPEG file with the [`black`](theme#colors) used as the background color.
| Parameter | Type | Description |
| :-------- | :----: | :---------------------- |
| `image` | String | Path to opengraph image |
## `terms`

View file

@ -24,15 +24,13 @@ web:
file: null
title: Help
logo:
dark: /home/ubuntu/hyperglass/hyperglass-light.png
light: /home/ubuntu/hyperglass/hyperglass-dark.png
favicon: /home/ubuntu/hyperglass/icon.png
dark: /home/ubuntu/hyperglass/hyperglass-light.svg
light: /home/ubuntu/hyperglass/hyperglass-dark.svg
favicon: /home/ubuntu/hyperglass/hyperglass-icon.svg
height: null
width: 384
width: "75%"
opengraph:
height: 1132
image: /images/hyperglass-opengraph.png
width: 7355
image: /home/ubuntu/hyperglass/hyperglass-opengraph.png
terms:
enable: true
file: null
@ -50,7 +48,7 @@ web:
theme:
default_color_mode: light
colors:
black: "#262626"
black: "#121212"
blue: "#314cb6"
cyan: "#118ab2"
danger: "#d84b4b"

View file

@ -13,8 +13,8 @@ description: Customize the Logo & Favicon
| `light` | String | hyperglass logo | Path to logo that will be used in light mode |
| `dark` | String | hyperglass logo | Path to logo that will be used in dark mode |
| `favicon` | String | hyperglass icon | Path to logo that will be used as the favicon |
| `width` | Integer | `384` | Maximum logo width in pixels |
| `height` | Integer | | Maximum logo height in pixels |
| `width` | Integer | `75%` | Maximum logo width as a percentage |
| `height` | Integer | | Maximum logo height as a percentage |
### Favicon

View file

@ -35,8 +35,8 @@ import PageLink from "../../src/components/PageLink";
| `warning` | String | | Warning message/status color |
| `error` | String | | Error message/status color |
| `danger` | String | | Danger message/status color |
| `black` | String | <Color hex="#262626"/> | Used as background color in dark mode |
| `white` | String | <Color hex="#f7f7f7"/> | Used as background color in light mode |
| `black` | String | <Color hex="#121212"/> | Used as background color in dark mode |
| `white` | String | <Color hex="#f5f6f7"/> | Used as background color in light mode |
| `red` | String | <Color hex="#d84b4b"/> | Used as `danger` color if undefined |
| `orange` | String | <Color hex="#ff6b35"/> | Used as `error` color if undefined |
| `yellow` | String | <Color hex="#edae49"/> | Used as `warning` color if undefined |

View file

@ -1,21 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://hyperglass.io/docs/cache</loc>
<loc>https://hyperglass.io/docs/adding-devices</loc>
</url>
<url>
<loc>https://hyperglass.io/docs/commands</loc>
</url>
<url>
<loc>https://hyperglass.io/docs/configuration</loc>
</url>
<url>
<loc>https://hyperglass.io/docs/devices</loc>
</url>
<url>
<loc>https://hyperglass.io/docs/getting-started</loc>
</url>
@ -36,6 +28,10 @@
<loc>https://hyperglass.io/docs/messages</loc>
</url>
<url>
<loc>https://hyperglass.io/docs/parameters</loc>
</url>
<url>
<loc>https://hyperglass.io/docs/platforms</loc>
</url>
@ -45,7 +41,11 @@
</url>
<url>
<loc>https://hyperglass.io/docs/queries</loc>
<loc>https://hyperglass.io/docs/query-settings</loc>
</url>
<url>
<loc>https://hyperglass.io/docs/response-caching</loc>
</url>
<url>
@ -57,7 +57,7 @@
</url>
<url>
<loc>https://hyperglass.io/docs/structured-data</loc>
<loc>https://hyperglass.io/docs/table-output</loc>
</url>
<url>

View file

@ -2,11 +2,10 @@
# Standard Library
import os
from typing import Optional
from pathlib import Path
# Third Party
from pydantic import FilePath, StrictInt, validator
from pydantic import FilePath, validator
# Project
from hyperglass.models import HyperglassModel
@ -18,8 +17,6 @@ DEFAULT_IMAGES = Path(__file__).parent.parent.parent / "images"
class OpenGraph(HyperglassModel):
"""Validation model for params.opengraph."""
width: Optional[StrictInt]
height: Optional[StrictInt]
image: FilePath = DEFAULT_IMAGES / "hyperglass-opengraph.jpg"
@validator("image")