Compare commits
10 commits
02babbe60b
...
70efaf77d6
| Author | SHA1 | Date | |
|---|---|---|---|
| 70efaf77d6 | |||
| 41211d0dd3 | |||
| 8efbad5c63 | |||
| 16808ee943 | |||
| 805743bb17 | |||
| 5c724783f3 | |||
| 4e0ca77624 | |||
| ced9f011f2 | |||
| d17cb3509a | |||
| 9a65be07e4 |
38 changed files with 180 additions and 132 deletions
|
|
@ -1,17 +1,20 @@
|
|||
// @ts-check
|
||||
import { defineConfig } from "astro/config";
|
||||
|
||||
const setLayout = () => {
|
||||
return function (_, file) {
|
||||
if (file.data.astro.frontmatter.layout === undefined) {
|
||||
file.data.astro.frontmatter.layout = "@layouts/BaseLayout.astro";
|
||||
}
|
||||
};
|
||||
};
|
||||
//const setLayout = () => {
|
||||
// return function (_, file) {
|
||||
// if (file.data.astro.frontmatter.layout === undefined) {
|
||||
// file.data.astro.frontmatter.layout = "@layouts/BaseLayout.astro";
|
||||
// }
|
||||
// };
|
||||
//};
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
markdown: {
|
||||
remarkPlugins: [setLayout],
|
||||
//remarkPlugins: [setLayout],
|
||||
shikiConfig: {
|
||||
theme: "catppuccin-latte",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
18
astro/src/components/DocumentBreadcrumbs.astro
Normal file
18
astro/src/components/DocumentBreadcrumbs.astro
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
import { getDocumentPath, getDocumentTitle, getAncestorDocuments } from "@utils/docs";
|
||||
|
||||
const { document } = Astro.props;
|
||||
const ancestorDocuments = await getAncestorDocuments(document);
|
||||
---
|
||||
<div class="breadcrumbs">
|
||||
<a href="/">Home</a>
|
||||
{ancestorDocuments.map(document => {
|
||||
const title = getDocumentTitle(document);
|
||||
const path = getDocumentPath(document);
|
||||
|
||||
return (
|
||||
<span>⟩</span>
|
||||
<a href={path}>{title}</a>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
|
@ -4,14 +4,14 @@ import { getDocumentPath, getDocumentTitle, getChildDocuments } from "@utils/doc
|
|||
const { document } = Astro.props;
|
||||
const childDocuments = await getChildDocuments(document);
|
||||
---
|
||||
<ul>
|
||||
<ul class="menu">
|
||||
{childDocuments.map(document => {
|
||||
const title = getDocumentTitle(document);
|
||||
const path = getDocumentPath(document);
|
||||
|
||||
return (
|
||||
<li>
|
||||
<a href={path}>{title}</a>
|
||||
<a href={path}>{title}</a>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
const { pageTitle } = Astro.props;
|
||||
import "@styles/main.css";
|
||||
---
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
---
|
||||
import BaseLayout from "@layouts/BaseLayout.astro";
|
||||
import DocumentMenu from "@components/DocumentMenu.astro";
|
||||
import { getDocumentPath, getDocumentTitle } from "@utils/docs";
|
||||
|
||||
const { document } = Astro.props;
|
||||
const pageTitle = getDocumentTitle(document);
|
||||
---
|
||||
<BaseLayout pageTitle={pageTitle}>
|
||||
<slot />
|
||||
<DocumentMenu document={document} />
|
||||
</BaseLayout>
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
---
|
||||
import { getCollection, render } from 'astro:content';
|
||||
|
||||
import DocumentLayout from "@layouts/DocumentLayout.astro";
|
||||
import BaseLayout from "@layouts/BaseLayout.astro";
|
||||
import DocumentMenu from "@components/DocumentMenu.astro";
|
||||
import DocumentBreadcrumbs from "@components/DocumentBreadcrumbs.astro";
|
||||
import { getDocumentPath, getDocumentTitle, getChildDocuments } from "@utils/docs";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
|
|
@ -14,9 +16,11 @@ export async function getStaticPaths() {
|
|||
}
|
||||
|
||||
const { document } = Astro.props;
|
||||
const paths = await getStaticPaths();
|
||||
const pageTitle = getDocumentTitle(document);
|
||||
const { Content } = await render(document);
|
||||
---
|
||||
<DocumentLayout document={document}>
|
||||
<BaseLayout pageTitle={pageTitle}>
|
||||
<DocumentBreadcrumbs document={document} />
|
||||
<Content />
|
||||
</DocumentLayout>
|
||||
<DocumentMenu document={document} />
|
||||
</BaseLayout>
|
||||
|
|
|
|||
18
astro/src/styles/main.css
Normal file
18
astro/src/styles/main.css
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
html, body {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
main {
|
||||
margin: 0 auto;
|
||||
max-width: 600px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.astro-code {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
ul.menu {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
import type { MarkdownHeading } from "astro";
|
||||
import { getCollection, type CollectionEntry } from "astro:content";
|
||||
|
||||
export function getDocumentPath(document: CollectionEntry<"documents">) {
|
||||
return "/" + document.id.replace(/\/_index$/, "");
|
||||
export type Document = CollectionEntry<"docs">;
|
||||
|
||||
export function getDocumentPath(document: Document) {
|
||||
return "/" + document.id.replace(/\/_index$/, "") + "/";
|
||||
}
|
||||
|
||||
export function getDocumentTitle(document: CollectionEntry<"documents">) {
|
||||
export function getDocumentTitle(document: Document) {
|
||||
const headings: MarkdownHeading[] =
|
||||
(document.rendered?.metadata?.headings as MarkdownHeading[]) || [];
|
||||
const firstHeading = headings[0];
|
||||
|
|
@ -17,17 +19,37 @@ export function getDocumentTitle(document: CollectionEntry<"documents">) {
|
|||
return null;
|
||||
}
|
||||
|
||||
export async function getChildDocuments(
|
||||
parentDocument: CollectionEntry<"documents"> | undefined,
|
||||
) {
|
||||
export async function getChildDocuments(parentDocument: Document | undefined) {
|
||||
const documents = await getCollection("docs");
|
||||
|
||||
const basePath =
|
||||
parentDocument !== undefined ? getDocumentPath(parentDocument) : "";
|
||||
const pathPattern = new RegExp(`^${basePath}/[^/]+$`);
|
||||
parentDocument !== undefined ? getDocumentPath(parentDocument) : "/";
|
||||
const pathPattern = new RegExp(`^${basePath}[^/]+/$`);
|
||||
|
||||
return documents.filter((document) => {
|
||||
const documentPath = getDocumentPath(document);
|
||||
return pathPattern.test(documentPath) && documentPath !== basePath;
|
||||
const childDocuments = documents.filter((document) => {
|
||||
const path = getDocumentPath(document);
|
||||
return pathPattern.test(path) && path !== basePath;
|
||||
});
|
||||
|
||||
return childDocuments.sort((a, b) => {
|
||||
const aWeight = a.data.weight || 0;
|
||||
const bWeight = b.data.weight || 0;
|
||||
|
||||
return aWeight - bWeight;
|
||||
});
|
||||
}
|
||||
|
||||
export async function getAncestorDocuments(document: Document) {
|
||||
const documents = await getCollection("docs");
|
||||
|
||||
const descendantPath = getDocumentPath(document);
|
||||
|
||||
const ancestorDocuments = documents.filter((document) => {
|
||||
const path = getDocumentPath(document);
|
||||
return descendantPath.startsWith(path) && path !== descendantPath;
|
||||
});
|
||||
|
||||
return ancestorDocuments.sort((a, b) => {
|
||||
return getDocumentPath(a).length - getDocumentPath(b).length;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
"@components/*": ["src/components/*"],
|
||||
"@layouts/*": ["src/layouts/*"],
|
||||
"@pages/*": ["src/pages/*"],
|
||||
"@styles/*": ["src/styles/*"],
|
||||
"@utils/*": ["src/utils/*"]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ services:
|
|||
build:
|
||||
context: docker
|
||||
dockerfile: ./docker/Dockerfile
|
||||
container_name: server
|
||||
container_name: notes
|
||||
restart: always
|
||||
volumes:
|
||||
- ./hugo/public:/usr/share/nginx/html:ro
|
||||
- ./astro/dist:/usr/share/nginx/html:ro
|
||||
ports:
|
||||
- "42069:80"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,4 @@ server {
|
|||
auth_basic "Restricted";
|
||||
auth_basic_user_file auth.htpasswd;
|
||||
}
|
||||
|
||||
# Disable authentication for certbot challenge dir.
|
||||
location /.well-known/acme-challenge/ {
|
||||
auth_basic off;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
# My notes
|
||||
|
||||
Muh notes.
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
+++
|
||||
weight = 9000
|
||||
+++
|
||||
---
|
||||
weight: 9000
|
||||
---
|
||||
|
||||
# Chess
|
||||
|
|
|
|||
1
docs/chess/openings/_index.md
Normal file
1
docs/chess/openings/_index.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
# Chess Openings
|
||||
|
|
@ -0,0 +1 @@
|
|||
# Design
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
+++
|
||||
weight = 3100
|
||||
+++
|
||||
---
|
||||
weight: 3100
|
||||
---
|
||||
|
||||
# Electronics
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
+++
|
||||
weight = 1100
|
||||
+++
|
||||
---
|
||||
weight: 1100
|
||||
---
|
||||
|
||||
# Finances
|
||||
|
|
|
|||
1
docs/finances/insurance/_index.md
Normal file
1
docs/finances/insurance/_index.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
# Insurance
|
||||
1
docs/handicrafts/_index.md
Normal file
1
docs/handicrafts/_index.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
# Handicrafts
|
||||
|
|
@ -1,33 +1,5 @@
|
|||
+++
|
||||
weight = 3000
|
||||
+++
|
||||
---
|
||||
weight: 3000
|
||||
---
|
||||
|
||||
# Home network
|
||||
|
||||
## Self-hosted services
|
||||
|
||||
### Implemented
|
||||
|
||||
- NGINX reverse proxy
|
||||
- Pi-hole DNS server
|
||||
- Jellyfin media server
|
||||
- Hugo notes website
|
||||
- Lacks proper auth (currently using Basic)
|
||||
|
||||
### Planned
|
||||
|
||||
System administration:
|
||||
|
||||
- Vouch SSO proxy [[Github](https://github.com/vouch/vouch-proxy)]
|
||||
- Provide identity management for multiple apps running on the server.
|
||||
- Authentik identity provider [[Github](https://github.com/goauthentik/authentik)]
|
||||
- IdP for Vouch.
|
||||
- Grafana Metrics and Monitoring [[Github](https://github.com/grafana/grafana)]
|
||||
- Observability.
|
||||
- Laravel notes website
|
||||
- Markdown files as content.
|
||||
- See [Aaron Francis's blog](https://aaronfrancis.com/2021/blogging-with-markdown-in-laravel-1d45f4fa).
|
||||
|
||||
Services:
|
||||
|
||||
- Bitwarden secrets vault [[Github](https://github.com/bitwarden/server)]
|
||||
|
|
|
|||
1
docs/home-network/admin/_index.md
Normal file
1
docs/home-network/admin/_index.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
# Admin
|
||||
33
docs/home-network/overview.md
Normal file
33
docs/home-network/overview.md
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
weight: -1
|
||||
---
|
||||
|
||||
# Home network overview
|
||||
|
||||
## Self-hosted services
|
||||
|
||||
### Implemented
|
||||
|
||||
- NGINX reverse proxy
|
||||
- Pi-hole DNS server
|
||||
- Jellyfin media server
|
||||
- Hugo notes website
|
||||
- Lacks proper auth (currently using Basic)
|
||||
|
||||
## Planned features
|
||||
|
||||
System administration:
|
||||
|
||||
- Vouch SSO proxy [[Github](https://github.com/vouch/vouch-proxy)]
|
||||
- Provide identity management for multiple apps running on the server.
|
||||
- Authentik identity provider [[Github](https://github.com/goauthentik/authentik)]
|
||||
- IdP for Vouch.
|
||||
- Grafana Metrics and Monitoring [[Github](https://github.com/grafana/grafana)]
|
||||
- Observability.
|
||||
- Laravel notes website
|
||||
- Markdown files as content.
|
||||
- See [Aaron Francis's blog](https://aaronfrancis.com/2021/blogging-with-markdown-in-laravel-1d45f4fa).
|
||||
|
||||
Services:
|
||||
|
||||
- Bitwarden secrets vault [[Github](https://github.com/bitwarden/server)]
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
+++
|
||||
weight = 1200
|
||||
+++
|
||||
---
|
||||
weight: 1200
|
||||
---
|
||||
|
||||
# Household
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
+++
|
||||
weight = 8000
|
||||
+++
|
||||
---
|
||||
weight: 8000
|
||||
---
|
||||
|
||||
# Latin
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
# Lingus Latina per se Illustrata
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
+++
|
||||
weight = 6000
|
||||
+++
|
||||
---
|
||||
weight: 6000
|
||||
---
|
||||
|
||||
# Parenting
|
||||
|
|
|
|||
1
docs/professional/_index.md
Normal file
1
docs/professional/_index.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
# Professional
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
+++
|
||||
title = 'Programming languages'
|
||||
+++
|
||||
|
||||
# Programming languages
|
||||
|
||||
## PHP
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
+++
|
||||
title = 'Plan for this section'
|
||||
+++
|
||||
|
||||
# Plan for this section
|
||||
|
||||
List the various problem domains:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
+++
|
||||
weight = 6100
|
||||
+++
|
||||
---
|
||||
weight: 6100
|
||||
---
|
||||
|
||||
# Seasonal events
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
+++
|
||||
weight = 1000
|
||||
+++
|
||||
---
|
||||
weight: 1000
|
||||
---
|
||||
|
||||
# Self-care
|
||||
|
|
|
|||
0
docs/self-care/exercise/movement-by-david/_index.md
Normal file
0
docs/self-care/exercise/movement-by-david/_index.md
Normal file
3
hugo/.gitignore
vendored
3
hugo/.gitignore
vendored
|
|
@ -1,3 +0,0 @@
|
|||
# Build files
|
||||
/public/
|
||||
/resources/_gen/
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
+++
|
||||
date = '{{ .Date }}'
|
||||
draft = true
|
||||
title = '{{ replace .File.ContentBaseName "-" " " | title }}'
|
||||
+++
|
||||
|
|
@ -1 +0,0 @@
|
|||
@import "plugins/scrollbars";
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
baseURL = 'https://example.org/'
|
||||
languageCode = 'en-us'
|
||||
title = 'My Notes'
|
||||
theme = 'hugo-book'
|
||||
contentDir = '../docs'
|
||||
ignoreLogs = ['warning-goldmark-raw-html']
|
||||
|
||||
[params]
|
||||
BookSection = '*'
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 645c868cec1396548456eac68205eabbd8ca9564
|
||||
6
push.sh
6
push.sh
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd hugo
|
||||
hugo
|
||||
rsync -a public/* raspberrypi:/var/www/html/notes/hugo/public
|
||||
cd astro
|
||||
npm run astro build
|
||||
rsync -a dist/* raspberrypi:/srv/notes/astro/dist
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue