Skip to content

Commit

Permalink
improve docs header, nav and social cards
Browse files Browse the repository at this point in the history
  • Loading branch information
benphelps committed Jun 14, 2024
1 parent aa33cf7 commit 4d88ea1
Show file tree
Hide file tree
Showing 15 changed files with 293 additions and 27 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/docs-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ jobs:
mkdocs-material-
- run: sudo apt-get install pngquant
- run: pip install mike
- run: pip install mkdocs-material
- run: pip install "mkdocs-material[imaging]"
- run: pip install mkdocs-material mkdocs-redirects "mkdocs-material[imaging]"
- name: Test Docs Build
run: MKINSIDERS=false mkdocs build
deploy:
Expand All @@ -78,7 +77,7 @@ jobs:
- run: sudo apt-get install pngquant
- run: pip install mike==2.0.0
- run: pip install git+https://${GH_TOKEN}@github.com/benphelps/mkdocs-material-insiders.git
- run: pip install "mkdocs-material[imaging]"
- run: pip install mkdocs-redirects "mkdocs-material[imaging]"
- name: Set Git config
run: |
git config --global user.name "GitHub Action"
Expand Down
1 change: 1 addition & 0 deletions docs/configs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Configuration
description: Homepage Configuration
icon: material/cog
---

Homepage uses YAML for configuration, YAML stands for "YAML Ain't Markup Language.". It's a human-readable data serialization format that's a superset of JSON. Great for config files, easy to read and write. Supports complex data types like lists and objects. **Indentation matters.** If you already use Docker Compose, you already use YAML.
Expand Down
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Home
description: A modern, fully static, fast, secure, fully proxied, highly customizable application dashboard with integrations for over 100 services and translations into multiple languages.
icon: material/home
hide:
- navigation
- toc
Expand Down
1 change: 1 addition & 0 deletions docs/installation/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Installation
description: Docs intro
icon: simple/docker
---

<p>
Expand Down
252 changes: 252 additions & 0 deletions docs/layouts/custom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
# Copyright (c) 2016-2024 Martin Donath <[email protected]>

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.

# -----------------------------------------------------------------------------
# Configuration
# -----------------------------------------------------------------------------

# Definitions
definitions:
# Background image
- &background_image >-
{{ layout.background_image | x }}

# Background color (default: indigo)
- &background_color >-
{%- if layout.background_color -%}
{{ layout.background_color }}
{%- else -%}
{%- set palette = config.theme.palette or {} -%}
{%- if not palette is mapping -%}
{%- set list = palette | selectattr("primary") | list + palette -%}
{%- set palette = list | first -%}
{%- endif -%}
{%- set primary = palette.get("primary", "indigo") -%}
{%- set primary = primary.replace(" ", "-") -%}
{{ {
"red": "#ef5552",
"pink": "#e92063",
"purple": "#ab47bd",
"deep-purple": "#7e56c2",
"indigo": "#4051b5",
"blue": "#2094f3",
"light-blue": "#02a6f2",
"cyan": "#00bdd6",
"teal": "#009485",
"green": "#4cae4f",
"light-green": "#8bc34b",
"lime": "#cbdc38",
"yellow": "#ffec3d",
"amber": "#ffc105",
"orange": "#ffa724",
"deep-orange": "#ff6e42",
"brown": "#795649",
"grey": "#757575",
"blue-grey": "#546d78",
"black": "#000000",
"white": "#ffffff"
}[primary] or "#4051b5" }}
{%- endif -%}

# Text color (default: white)
- &color >-
{%- if layout.color -%}
{{ layout.color }}
{%- else -%}
{%- set palette = config.theme.palette or {} -%}
{%- if not palette is mapping -%}
{%- set list = palette | selectattr("primary") | list + palette -%}
{%- set palette = list | first -%}
{%- endif -%}
{%- set primary = palette.get("primary", "indigo") -%}
{%- set primary = primary.replace(" ", "-") -%}
{{ {
"red": "#ffffff",
"pink": "#ffffff",
"purple": "#ffffff",
"deep-purple": "#ffffff",
"indigo": "#ffffff",
"blue": "#ffffff",
"light-blue": "#ffffff",
"cyan": "#ffffff",
"teal": "#ffffff",
"green": "#ffffff",
"light-green": "#ffffff",
"lime": "#000000",
"yellow": "#000000",
"amber": "#000000",
"orange": "#000000",
"deep-orange": "#ffffff",
"brown": "#ffffff",
"grey": "#ffffff",
"blue-grey": "#ffffff",
"black": "#ffffff",
"white": "#000000"
}[primary] or "#ffffff" }}
{%- endif -%}

# Font family (default: Roboto)
- &font_family >-
{%- if layout.font_family -%}
{{ layout.font_family }}
{%- elif config.theme.font is mapping -%}
{{ config.theme.font.get("text", "Roboto") }}
{%- else -%}
Roboto
{%- endif -%}

# Font variant
- &font_variant >-
{%- if layout.font_variant -%}
{{ layout.font_variant }}
{%- endif -%}

# Site name
- &site_name >-
{{ config.site_name }}

# Page title
- &page_title >-
{%- if layout.title -%}
{{ layout.title }}
{%- else -%}
{{ page.meta.get("title", page.title) }}
{%- endif -%}

# Page title with site name
- &page_title_with_site_name >-
{%- if not page.is_homepage -%}
{{ page.meta.get("title", page.title) }} - {{ config.site_name }}
{%- else -%}
{{ page.meta.get("title", page.title) }}
{%- endif -%}

# Page description
- &page_description >-
{%- if layout.description -%}
{{ layout.description }}
{%- else -%}
{{ page.meta.get("description", config.site_description) | x }}
{%- endif -%}

# Page icon
- &page_icon >-
{{ page.meta.icon | x }}

# Logo
- &logo >-
{%- if layout.logo -%}
{{ layout.logo }}
{%- elif config.theme.logo -%}
{{ config.docs_dir }}/{{ config.theme.logo }}
{%- endif -%}

# Logo (icon)
- &logo_icon >-
{%- if not layout.logo and config.theme.icon -%}
{{ config.theme.icon.logo | x }}
{%- endif -%}

# Meta tags
tags:
# Open Graph
og:type: website
og:title: *page_title_with_site_name
og:description: *page_description
og:image: "{{ image.url }}"
og:image:type: "{{ image.type }}"
og:image:width: "{{ image.width }}"
og:image:height: "{{ image.height }}"
og:url: "{{ page.canonical_url }}"

# Twitter
twitter:card: summary_large_image
twitter:title: *page_title_with_site_name
twitter:description: *page_description
twitter:image: "{{ image.url }}"

# -----------------------------------------------------------------------------
# Specification
# -----------------------------------------------------------------------------

# Card size and layers
size: { width: 1200, height: 630 }
layers:
# Background
- background:
image: *background_image
color: *background_color

# Page icon
- size: { width: 630, height: 630 }
offset: { x: 800, y: 0 }
icon:
value: *page_icon
color: "#FFFFFF20"

# Logo
- size: { width: 64, height: 64 }
offset: { x: 64, y: 64 }
background:
image: *logo
icon:
value: *logo_icon
color: *color

# Site name
- size: { width: 768, height: 42 }
offset: { x: 160, y: 74 }
typography:
content: *site_name
color: *color
font:
family: *font_family
variant: *font_variant
style: Bold

# Page title
- size: { width: 864, height: 256 }
offset: { x: 62, y: 192 }
typography:
content: *page_title
align: start
color: *color
line:
amount: 3
height: 1.25
font:
family: *font_family
variant: *font_variant
style: Bold

# Page description
- size: { width: 864, height: 64 }
offset: { x: 64, y: 512 }
typography:
content: *page_description
align: start
color: *color
line:
amount: 2
height: 1.5
font:
family: *font_family
variant: *font_variant
style: Regular
1 change: 1 addition & 0 deletions docs/more/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: More
description: More homepage resources and guides.
icon: material/information-slab-circle
---

Here you'll find resources and guides for Homepage, troubleshooting tips, and more.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Troubleshooting
description: Basic Troubleshooting

icon: material/message-question
hide:
- navigation
---
Expand Down
6 changes: 3 additions & 3 deletions docs/widgets/authoring/api.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: API Guide
description: How to fetch data from an API in Homepage widgets.
description: Get comfortable with making API calls from inside your widget.
---

Homepage provides the `useWidgetAPI` hook to help you fetch data from an API. This hook insures that the data is fetched using a proxy, and is critical for security.
Expand Down Expand Up @@ -29,7 +29,7 @@ The `widget` argument is the metadata object for the widget. It contains informa

### `endpoint`

The `endpoint` argument is the name of the endpoint to fetch data from. This is [defined in the widget metadata object](widget.md#endpoint). The `useWidgetAPI` hook uses this argument to determine which endpoint to fetch data from.
The `endpoint` argument is the name of the endpoint to fetch data from. This is [defined in the widget metadata object](metadata.md#endpoint). The `useWidgetAPI` hook uses this argument to determine which endpoint to fetch data from.

If no endpoint is provided, the `useWidgetAPI` hook will call the API endpoint defined in the widget metadata object directly.

Expand All @@ -47,4 +47,4 @@ export default function Component({ service }) {
}
```

The `params` must be [whitelisted in the widget metadata object](widget.md#params). This is done to prevent arbitrary query parameters from being passed to the API.
The `params` must be [whitelisted in the widget metadata object](metadata.md#params). This is done to prevent arbitrary query parameters from being passed to the API.
2 changes: 1 addition & 1 deletion docs/widgets/authoring/component.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Component Guide
description: How to create and configure Homepage widget components.
description: Learn more about the widget component in Homepage, and how to build your widget UI.
---

Homepage widgets are built using React components. These components are responsible for fetching data from the API and rendering the widget UI. Homepage provides a set of hooks and utilities to help you build your widget component.
Expand Down
9 changes: 5 additions & 4 deletions docs/widgets/authoring/index.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
title: Homepage Widget Guides
description: How to create and configure Homepage widgets.
title: Guides & Tutorials
description: Learn how to create and customize widgets in Homepage. Explore translations, widget components, widget metadata, proxy handlers, and making API calls.
icon: fontawesome/solid/graduation-cap
---

Widgets are a core component of Homepage. They are used to display information about your system, services, and environment.

## Overview

If you are new to Homepage widgets, and are looking to create a new widget, please follow along with the guide here: [Widget Guide](guide.md).
If you are new to Homepage widgets, and are looking to create a new widget, please follow along with the guide here: [Widget Tutorial](tutorial.md).

### Translations

Expand All @@ -27,7 +28,7 @@ If you are looking to learn more about widget components, please refer to the gu

Widget metadata defines the configuration of the widget. It defines the API endpoint to fetch data from, the proxy handler to use, and any data mappings.

If you are looking to learn more about widget metadata, endpoint and data mapping, please refer to the guide here: [Metadata Guide](widget.md).
If you are looking to learn more about widget metadata, endpoint and data mapping, please refer to the guide here: [Metadata Guide](metadata.md).

If you are looking to learn more about proxy handlers, please refer to the guide here: [Proxies Guide](proxies.md).

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Metadata Guide
description: How to create and configure Homepage widget metadata.
description: Explore all the metadata properties that can be used to configure a widget in Homepage.
---

Here, we will go over how to create and configure Homepage widget metadata. Metadata is a JS object that contains information about the widget, such as the API endpoint, proxy handler, and mappings. This metadata is used by Homepage to fetch data from the API and pass it to the widget.
Expand Down
2 changes: 1 addition & 1 deletion docs/widgets/authoring/proxies.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Proxies Guide
description: How to use and create Homepage widget proxies.
description: Learn about proxy handlers in Homepage, and how to securely fetch data from an API.
---

Homepage includes a set of built-in proxy handlers that can be used to fetch data from an API. We will go over how to use these proxy handlers and briefly cover how to create your own.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Widget Guide
description: How to create a custom widget for Homepage.
title: Widget Tutorial
description: Follow along with this guide to learn how to create a custom widget for Homepage. We'll cover the basic structure of a widget, how to use translations, and how to fetch data from an API.
---

In this guide, we'll walk through the process of creating a custom widget for Homepage. We'll cover the basic structure of a widget, how to use translations, and how to fetch data from an API. By the end of this guide, you'll have a solid understanding of how to build your own custom widget.
Expand Down
Loading

0 comments on commit 4d88ea1

Please sign in to comment.