Compare commits

..

2 Commits

Author SHA1 Message Date
Leni Aniva e8e52588e4
fix: Make name non-sticky 2024-10-26 18:19:39 -07:00
Leni Aniva 482f7e59a7
feat: Sticky navbar 2024-10-26 18:16:20 -07:00
8 changed files with 24 additions and 50 deletions

View File

@ -11,7 +11,7 @@ repos:
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: [feat, fix, chore, test, build, merge, refactor, doc]
args: [feat, fix, chore, test, build, merge, refactor]
- repo: local
hooks:
- id: eslint

View File

@ -19,18 +19,6 @@ To insert custom content, create a directory with a similar structure to
directory. The website will be built statically in `build/`. Note that changing
`favicon.svg` will require modifying the `static/` folder.
Set `metadata.json` based on the example to have a custom avatar and background
image.
- `name`: Displayed name on the home page
- `blogName`: Displayed name of the blog
- `url`: The site url
- `frontDescription`: The text above the main navbar
- `frontCover`: Path to the cover image
- `picture`: Avatar
- `links`: A map of brands to links
- `extra`: Extra pages showing on the navbar
- `markdown`: `{ "highlighterLangs": [ ... ], "katex": [ ... ] }`
## Developing
Install [pre-commit](https://pre-commit.com/).

View File

@ -12,12 +12,5 @@
},
"extra": [
{ "route": "/archives", "name": "Archives" }
],
"markdown": {
"highlighterLangs": [
"python",
"lean",
"tex"
]
}
}

View File

@ -26,7 +26,3 @@ $$
$$
\vec z^{(l+1)} = \mat M\vec z^{(l)} + \vec b
$$
```tex
\\newcommand{\\cirno}{9}
```

View File

@ -1,6 +1,7 @@
<script lang="ts">
import '../app.css';
import { page } from '$app/stores';
import { name } from '$content/metadata.json';
import Footer from "./Footer.svelte";
import Navbar from "./Navbar.svelte";
import PageTransition from "./PageTransition.svelte";
@ -11,7 +12,8 @@
<!-- Homepage has its own navbar with animations -->
{#if $page.url.pathname != "/"}
<div id="layout">
<div id="navbar">
<div id="nav">
<p id="bio-name">{name}</p>
<Navbar />
<slot name="header" />
</div>
@ -31,6 +33,12 @@
{/if}
<style>
#bio-name {
font-family: serif;
font-size: 3rem;
font-weight: normal;
color: var(--name);
}
#layout {
max-width: max(80vw, 100vh);
margin-left: auto;
@ -58,7 +66,7 @@
width: min(100vw, max(50vw, 100vh));
grid-area: content;
}
#navbar {
#nav {
align-self: right;
padding-left: 10px;
grid-area: nav;

View File

@ -19,22 +19,15 @@
import metadata from '$content/metadata.json';
const iconMap: Map<string, string> = {
"orcid": "fa-brands fa-orcid",
"google-scholar": "fa-brands fa-google-scholar",
"bitbucket": "fa-brands fa-bitbucket",
"discord": "fa-brands fa-discord",
"email": "fa-solid fa-envelope",
"bitbucket": "fa-brands fa-bitbucket",
"github": "fa-brands fa-github",
"gitlab": "fa-brands fa-gitlab",
"open-source": "fa-brands fa-osi",
"bluesky": "fa-brands fa-bluesky",
"youtube": "fa-brands fa-youtube",
"google-scholar": "fa-brands fa-google-scholar",
"instagram": "fa-brands fa-instagram",
"bandcamp": "fa-brands fa-bandcamp",
"pixiv": "fa-brands fa-pixiv",
"open-source": "fa-brands fa-osi",
"orcid": "fa-brands fa-orcid",
};
const iconLinks: [string, string][] = Object.entries(metadata.links).map(
([key, link]) => [iconMap[key], link]);

View File

@ -1,7 +1,6 @@
<script lang="ts">
import { page } from '$app/stores';
import { routes } from "$lib/sitemap.ts"
import { name } from '$content/metadata.json';
import ThemeSwitch from "$lib/components/ThemeSwitch.svelte"
import { Rss } from "lucide-svelte";
@ -12,7 +11,6 @@
</script>
<div id="navbar" class="h-5 space-x-4">
<p id="bio-name">{name}</p>
{#each routes as item}
<a
class="nav-link"
@ -35,7 +33,8 @@
display: flex;
flex-direction: column;
align-items: flex-end;
justify-content: between;
position: sticky;
top: 0;
}
@media (max-width: 700px) {
#navbar {

View File

@ -1,6 +1,5 @@
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import adapter from '@sveltejs/adapter-static';
import fs from 'fs';
import { mdsvex, escapeSvelte } from 'mdsvex';
import remarkAlert from './src/lib/markdown.js'
@ -13,9 +12,7 @@ import remarkMath from 'remark-math'
const contentDir = process.env?.CHRYSOBLOG_CONTENT ?? "src/content";
const metadata = await fs.promises.readFile(contentDir + "/metadata.json")
.then((file) => JSON.parse(file.toString()));
const langs = metadata?.markdown.highlighterLangs ?? [
const langs = [
"javascript",
"lean",
"lisp",
@ -29,7 +26,11 @@ const langs = metadata?.markdown.highlighterLangs ?? [
"c++",
"sh",
];
const katexOptions = metadata?.markdown.katex ?? {
const highlightingThemes = {
light: 'vitesse-light',
dark: 'vitesse-dark',
};
const katexOptions = {
macros: {
"\\Nat": "\\mathbb N",
"\\Complex": "\\mathbb C",
@ -38,10 +39,6 @@ const katexOptions = metadata?.markdown.katex ?? {
"\\rv": "\\mathrm",
},
};
const highlightingThemes = {
light: 'vitesse-light',
dark: 'vitesse-dark',
};
const themes = Object.keys(highlightingThemes).map(function(k){ return highlightingThemes[k] });
const highlighter = await getHighlighter({