mirror of
https://github.com/Lissy93/dashy.git
synced 2026-07-31 11:36:02 -04:00
244 lines
7.9 KiB
JavaScript
244 lines
7.9 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
const { themes } = require('prism-react-renderer');
|
|
const darkCodeTheme = themes.dracula;
|
|
const lightCodeTheme = themes.github;
|
|
const remarkGithubAlerts = require('./plugins/remark-github-alerts');
|
|
const injectDeploymentGrid = require('./plugins/inject-deployment-grid');
|
|
const { dashySidebar } = require('./sidebars');
|
|
|
|
/* External URLs */
|
|
const externalUrl = {
|
|
editUrl: 'https://github.com/Lissy93/dashy/edit/master/',
|
|
licenseUrl: 'https://github.com/Lissy93/dashy/blob/master/LICENSE',
|
|
aliciaUrl: 'https://aliciasykes.com',
|
|
dashyUrl: 'https://dashy.to',
|
|
};
|
|
|
|
const footerText = `<a href="${externalUrl.dashyUrl}">Dashy</a> - The Self-Hosted Dashboard for your Homelab`
|
|
+ `<br />License under <a href="${externalUrl.licenseUrl}">MIT</a>. `
|
|
+ `Copyright © ${new Date().getFullYear()} <a href="${externalUrl.aliciaUrl}">Alicia Sykes</a>`;
|
|
|
|
// A doc's footer label is its H1, matching what the sidebar shows
|
|
const docTitle = (id) => {
|
|
try {
|
|
const raw = fs.readFileSync(path.join(__dirname, 'docs', `${id}.md`), 'utf-8');
|
|
const h1 = raw.match(/^#\s+(.+)/m);
|
|
if (h1) {
|
|
const title = h1[1].replace(/!\[.*?\]\(.*?\)|[*_`]|[^\x00-\x7F]/g, '').trim();
|
|
if (title) return title;
|
|
}
|
|
} catch (e) { /* fall through to generated label */ }
|
|
return id.split('-').map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
|
|
};
|
|
|
|
// Footer doc columns mirror the sidebar categories, long ones split in two
|
|
const footerExtras = {
|
|
Community: [
|
|
{ label: 'Code of Conduct', href: 'https://github.com/Lissy93/dashy/blob/master/.github/CODE_OF_CONDUCT.md' },
|
|
],
|
|
Misc: [
|
|
{ label: 'Changelog', to: '/updates' },
|
|
],
|
|
};
|
|
const docFooterColumns = dashySidebar.flatMap(({ label: title, items: docs }) => {
|
|
const items = docs
|
|
.map((item) => (typeof item === 'string' ? item : item.link.id))
|
|
.map((id) => ({ label: docTitle(id), to: `/docs/${id}` }));
|
|
items.push(...(footerExtras[title] || []));
|
|
if (items.length <= 6) return [{ title, items }];
|
|
const mid = Math.ceil(items.length / 2);
|
|
return [
|
|
{ title: `${title} Pt 1`, items: items.slice(0, mid) },
|
|
{ title: `${title} Pt 2`, items: items.slice(mid) },
|
|
];
|
|
});
|
|
|
|
/** @type {import('@docusaurus/types').DocusaurusConfig} */
|
|
module.exports = {
|
|
title: 'Dashy',
|
|
tagline: 'The Ultimate Homepage for your Homelab',
|
|
url: externalUrl.dashyUrl,
|
|
baseUrl: '/',
|
|
onBrokenLinks: 'warn',
|
|
markdown: {
|
|
format: 'md',
|
|
mermaid: true,
|
|
hooks: {
|
|
onBrokenMarkdownLinks: 'warn',
|
|
},
|
|
},
|
|
customFields: {},
|
|
favicon: 'img/favicon.ico',
|
|
organizationName: 'lissy93', // Usually your GitHub org/user name.
|
|
projectName: 'dashy', // Usually your repo name.
|
|
headTags: [
|
|
// Preconnect to image CDNs (used for above-the-fold content)
|
|
{
|
|
tagName: 'link',
|
|
attributes: { rel: 'preconnect', href: 'https://pixelflare.cc' },
|
|
},
|
|
{
|
|
tagName: 'link',
|
|
attributes: { rel: 'preconnect', href: 'https://cdn.as93.net' },
|
|
},
|
|
// DNS-prefetch for API and third-party domains used client-side
|
|
{
|
|
tagName: 'link',
|
|
attributes: { rel: 'dns-prefetch', href: 'https://api.github.com' },
|
|
},
|
|
{
|
|
tagName: 'link',
|
|
attributes: { rel: 'dns-prefetch', href: 'https://no-track.as93.net' },
|
|
},
|
|
// Structured data
|
|
{
|
|
tagName: 'script',
|
|
attributes: { type: 'application/ld+json' },
|
|
innerHTML: JSON.stringify({
|
|
'@context': 'https://schema.org',
|
|
'@type': 'WebSite',
|
|
name: 'Dashy',
|
|
url: 'https://dashy.to',
|
|
description: 'The Ultimate Homepage for your Homelab',
|
|
publisher: {
|
|
'@type': 'Person',
|
|
name: 'Alicia Sykes',
|
|
url: 'https://aliciasykes.com',
|
|
},
|
|
}),
|
|
},
|
|
// RSS feed autodiscovery
|
|
{
|
|
tagName: 'link',
|
|
attributes: {
|
|
rel: 'alternate',
|
|
type: 'application/rss+xml',
|
|
title: 'Dashy — Releases & Updates',
|
|
href: '/rss.xml',
|
|
},
|
|
},
|
|
],
|
|
plugins: [
|
|
'docusaurus-plugin-sass',
|
|
require.resolve('./plugins/github-data'),
|
|
[
|
|
'@docusaurus/plugin-pwa',
|
|
{
|
|
offlineModeActivationStrategies: ['appInstalled', 'standalone', 'queryString'],
|
|
pwaHead: [
|
|
{ tagName: 'link', rel: 'manifest', href: '/manifest.json' },
|
|
{ tagName: 'meta', name: 'theme-color', content: '#54bff7' },
|
|
{ tagName: 'link', rel: 'apple-touch-icon', href: '/img/dashy.png' },
|
|
],
|
|
},
|
|
],
|
|
],
|
|
themes: [
|
|
[
|
|
require.resolve('@easyops-cn/docusaurus-search-local'),
|
|
{
|
|
hashed: true,
|
|
indexBlog: false,
|
|
docsRouteBasePath: '/docs',
|
|
},
|
|
],
|
|
'@docusaurus/theme-mermaid',
|
|
],
|
|
themeConfig: {
|
|
docs: {
|
|
sidebar: {
|
|
hideable: true,
|
|
autoCollapseCategories: true,
|
|
},
|
|
},
|
|
metadata: [
|
|
{ name: 'keywords', content: 'dashy, dashboard, homelab, self-hosted, docker, homepage' },
|
|
{ property: 'og:title', content: 'Dashy - The Ultimate Homepage for your Homelab' },
|
|
{ property: 'og:description', content: 'Dashy is a self-hosted dashboard app for your homelab. Manage all your services, with status checks, widgets, themes and more.' },
|
|
{ property: 'og:type', content: 'website' },
|
|
{ property: 'og:url', content: 'https://dashy.to' },
|
|
{ property: 'og:image', content: 'https://dashy.to/img/dashy.png' },
|
|
{ name: 'twitter:card', content: 'summary_large_image' },
|
|
{ name: 'twitter:title', content: 'Dashy - The Ultimate Homepage for your Homelab' },
|
|
{ name: 'twitter:description', content: 'Dashy is a self-hosted dashboard app for your homelab. Manage all your services, with status checks, widgets, themes and more.' },
|
|
{ name: 'twitter:image', content: 'https://dashy.to/img/dashy.png' },
|
|
],
|
|
// Dark & Light Mode
|
|
colorMode: {
|
|
defaultMode: 'dark',
|
|
},
|
|
// Prism Code Highlighting
|
|
prism: {
|
|
theme: lightCodeTheme,
|
|
darkTheme: darkCodeTheme,
|
|
additionalLanguages: ['bash', 'ini', 'toml', 'nix'],
|
|
},
|
|
// Top Navigation Bar
|
|
navbar: {
|
|
hideOnScroll: true,
|
|
title: 'Dashy',
|
|
logo: {
|
|
alt: 'Dashy Logo',
|
|
src: 'img/dashy.png',
|
|
},
|
|
items: [
|
|
{ label: 'GitHub', href: 'https://github.com/lissy93/dashy' },
|
|
{ label: 'Live Demo', href: 'https://demo.dashy.to' },
|
|
{ label: 'Quick Start', to: '/docs/quick-start' },
|
|
{ label: 'Documentation', to: '/docs' },
|
|
{ label: 'API', to: '/api' },
|
|
{ label: 'Changelog', to: '/updates' },
|
|
],
|
|
},
|
|
// Page Footer Links
|
|
footer: {
|
|
style: 'dark',
|
|
links: [
|
|
{
|
|
title: 'Intro',
|
|
items: [
|
|
{ label: 'GitHub', href: 'https://github.com/lissy93/dashy' },
|
|
{ label: 'Live Demo', href: 'https://demo.dashy.to' },
|
|
{ label: 'Quick Start', to: '/docs/quick-start' },
|
|
{ label: 'Documentation', to: '/docs' },
|
|
// { label: 'Updates', to: '/updates' },
|
|
],
|
|
},
|
|
...docFooterColumns,
|
|
],
|
|
copyright: footerText,
|
|
},
|
|
},
|
|
presets: [
|
|
[
|
|
'@docusaurus/preset-classic',
|
|
{
|
|
docs: {
|
|
sidebarPath: require.resolve('./sidebars.js'),
|
|
editUrl: externalUrl.editUrl,
|
|
showLastUpdateTime: true,
|
|
showLastUpdateAuthor: true,
|
|
beforeDefaultRemarkPlugins: [remarkGithubAlerts, injectDeploymentGrid],
|
|
},
|
|
sitemap: {
|
|
changefreq: 'weekly',
|
|
priority: 0.5,
|
|
filename: 'sitemap.xml',
|
|
},
|
|
theme: {
|
|
customCss: [
|
|
require.resolve('./src/styles/Colors.scss'),
|
|
require.resolve('./src/styles/Typography.scss'),
|
|
require.resolve('./src/styles/custom.scss'),
|
|
]
|
|
},
|
|
},
|
|
],
|
|
],
|
|
scripts: [
|
|
// Plausible Analytics (no tracking, just hit counter, using self-hosted Plausible)
|
|
{src: 'https://no-track.as93.net/js/script.js', defer: true, 'data-domain': 'dashy.to'},
|
|
],
|
|
};
|