Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89b83e3e43 | ||
|
|
39cf54624a | ||
|
|
722548118a | ||
|
|
a5b24dc9bf | ||
|
|
99867aa03e | ||
|
|
65f4dd1ac5 | ||
|
|
748f52241f | ||
|
|
21e1469b51 | ||
|
|
649102d1aa |
@@ -5,6 +5,8 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "main"
|
- "main"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
@@ -18,7 +20,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
- run: git clone ${{ vars.ARTICLES_REPOSITORY }} articles
|
- run: git clone ${{ vars.ARTICLES_REPOSITORY }} articles
|
||||||
- run: bun run build
|
- run: bun run build-only
|
||||||
|
- run: bun run post-build
|
||||||
- uses: actions/upload-artifact@v7
|
- uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: production-files
|
name: production-files
|
||||||
|
|||||||
@@ -20,10 +20,9 @@ bun run build
|
|||||||
- [x] build with github actions
|
- [x] build with github actions
|
||||||
- [x] config in sub repo
|
- [x] config in sub repo
|
||||||
- [x] copyright
|
- [x] copyright
|
||||||
- [ ] nav bar on top
|
- [x] nav bar on top
|
||||||
- [ ] date updated
|
- [x] date updated
|
||||||
- [ ] archive page
|
- [ ] archive page
|
||||||
- [ ] about page
|
- [x] about page
|
||||||
- [ ] contact/links
|
|
||||||
- [ ] link to previous/next article
|
- [ ] link to previous/next article
|
||||||
- [ ] proper docs
|
- [ ] proper docs
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 806 B |
@@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
title: Demo
|
||||||
|
author: kleπek
|
||||||
|
draft: false
|
||||||
|
thumbnail: ./thumbnail.jpg
|
||||||
|
date: 2026-01-01
|
||||||
|
---
|
||||||
|
|
||||||
|
## Images
|
||||||
|
|
||||||
|
PNG: 
|
||||||
|
|
||||||
|
## highlight.js
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
function test(arg1: string, arg2: number): string {
|
||||||
|
return `${arg1}: ${arg2}`
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
text/plain
|
||||||
|
```
|
||||||
|
|
||||||
|
## Mermaid
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
A --> B
|
||||||
|
```
|
||||||
|
|
||||||
|
## LaTex
|
||||||
|
|
||||||
|
$$\Large\color{Red}{\frac{\Delta K}{2}=\frac{T_{2}}{x_{2}(x_{2}-x_{1})}-\frac{T_{1}}{x_{1}(x_{2}-x_{1})}}$$
|
||||||
|
|
||||||
|
Inline LaTex $$\frac{\Delta K}{2}$$ in text
|
||||||
|
|
||||||
|
## Lucide Icons
|
||||||
|
|
||||||
|
Icon inside <i icon="atom"></i> text
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"base_url": "http://localhost/",
|
||||||
|
"title": "<i icon=notepad-text></i> My Blog",
|
||||||
|
"signature": "By <b>Me</b>",
|
||||||
|
"lang": "en",
|
||||||
|
"custom_head": "",
|
||||||
|
"home_count": 5,
|
||||||
|
"rss_link": "<i icon=rss></i> RSS",
|
||||||
|
"about_link": "<i icon=info></i> ABOUT",
|
||||||
|
"back_link": "<i icon=undo-2></i> Back to home",
|
||||||
|
"published_on": "Published on",
|
||||||
|
"updated_on": "Updated on",
|
||||||
|
"authored": "By",
|
||||||
|
"copyright": "<a style=\"text-decoration:none;color:inherit;\" target=_blank href=\"https://creativecommons.org/licenses/by-nc/4.0/\">CC BY-NC</a>"
|
||||||
|
}
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
/*
|
||||||
|
=================================================
|
||||||
|
https://www.joshwcomeau.com/css/custom-css-reset/
|
||||||
|
=================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Use a more-intuitive box-sizing model.
|
||||||
|
*/
|
||||||
|
*,
|
||||||
|
*::before,
|
||||||
|
*::after {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
2. Remove default margin
|
||||||
|
*/
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
3. Allow percentage-based heights in the application
|
||||||
|
*/
|
||||||
|
html,
|
||||||
|
body,
|
||||||
|
div#app {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Typographic tweaks!
|
||||||
|
4. Add accessible line-height
|
||||||
|
5. Improve text rendering
|
||||||
|
*/
|
||||||
|
body {
|
||||||
|
line-height: 1.5;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
6. Improve media defaults
|
||||||
|
*/
|
||||||
|
img,
|
||||||
|
picture,
|
||||||
|
video,
|
||||||
|
canvas,
|
||||||
|
svg {
|
||||||
|
display: block;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
7. Remove built-in form typography styles
|
||||||
|
*/
|
||||||
|
input,
|
||||||
|
button,
|
||||||
|
textarea,
|
||||||
|
select {
|
||||||
|
font: inherit;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
8. Avoid text overflows
|
||||||
|
*/
|
||||||
|
p,
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
h4,
|
||||||
|
h5,
|
||||||
|
h6 {
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
9. Create a root stacking context
|
||||||
|
*/
|
||||||
|
#root,
|
||||||
|
#__next {
|
||||||
|
isolation: isolate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================================================
|
||||||
|
https://blog.koley.in/2019/339-bytes-of-responsive-css
|
||||||
|
https://www.swyx.io/css-100-bytes
|
||||||
|
https://gist.github.com/JoeyBurzynski/617fb6201335779f8424ad9528b72c41
|
||||||
|
=================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
padding: 0;
|
||||||
|
max-width: 100%;
|
||||||
|
color: #222;
|
||||||
|
font-family: Verdana, serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
padding: 1.5rem;
|
||||||
|
margin: auto;
|
||||||
|
background-color: #ccc;
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
h4,
|
||||||
|
h5,
|
||||||
|
h6 {
|
||||||
|
margin: 1em 0 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
p,
|
||||||
|
ul,
|
||||||
|
ol,
|
||||||
|
pre,
|
||||||
|
img,
|
||||||
|
blockquote,
|
||||||
|
details {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
color: #444;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
opacity: 25%;
|
||||||
|
border-bottom: 0;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea,
|
||||||
|
input,
|
||||||
|
select,
|
||||||
|
pre,
|
||||||
|
.mono {
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (min-width: 768px) {
|
||||||
|
main {
|
||||||
|
max-width: 42rem;
|
||||||
|
}
|
||||||
|
table {
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MD BLOG
|
||||||
|
*/
|
||||||
|
|
||||||
|
nav {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home nav {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
vertical-align: text-bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home .nav-title {
|
||||||
|
font-size: xx-large;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav .nav-title {
|
||||||
|
font-size: larger;
|
||||||
|
font-weight: bold;
|
||||||
|
color: inherit;
|
||||||
|
display: inline-block;
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav .nav-items {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-info {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"configVersion": 0,
|
|
||||||
"workspaces": {
|
"workspaces": {
|
||||||
"": {
|
"": {
|
||||||
"name": "md-blog",
|
"name": "md-blog",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@keithclark/shaderview": "git+https://github.com/keithclark/shaderview",
|
||||||
"highlight.js": "^11.11.1",
|
"highlight.js": "^11.11.1",
|
||||||
"katex": "^0.16.45",
|
"katex": "^0.16.45",
|
||||||
"lucide": "^1.11.0",
|
"lucide": "^1.11.0",
|
||||||
@@ -210,6 +210,8 @@
|
|||||||
|
|
||||||
"@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
|
"@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
|
||||||
|
|
||||||
|
"@keithclark/shaderview": ["@keithclark/shaderview@github:keithclark/shaderview#fee0cf0", {}, "keithclark-shaderview-fee0cf0"],
|
||||||
|
|
||||||
"@mermaid-js/parser": ["@mermaid-js/parser@1.1.0", "", { "dependencies": { "langium": "^4.0.0" } }, "sha512-gxK9ZX2+Fex5zu8LhRQoMeMPEHbc73UKZ0FQ54YrQtUxE1VVhMwzeNtKRPAu5aXks4FasbMe4xB4bWrmq6Jlxw=="],
|
"@mermaid-js/parser": ["@mermaid-js/parser@1.1.0", "", { "dependencies": { "langium": "^4.0.0" } }, "sha512-gxK9ZX2+Fex5zu8LhRQoMeMPEHbc73UKZ0FQ54YrQtUxE1VVhMwzeNtKRPAu5aXks4FasbMe4xB4bWrmq6Jlxw=="],
|
||||||
|
|
||||||
"@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.1.4", "", { "dependencies": { "@tybys/wasm-util": "^0.10.1" }, "peerDependencies": { "@emnapi/core": "^1.7.1", "@emnapi/runtime": "^1.7.1" } }, "sha512-3NQNNgA1YSlJb/kMH1ildASP9HW7/7kYnRI2szWJaofaS1hWmbGI4H+d3+22aGzXXN9IJ+n+GiFVcGipJP18ow=="],
|
"@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.1.4", "", { "dependencies": { "@tybys/wasm-util": "^0.10.1" }, "peerDependencies": { "@emnapi/core": "^1.7.1", "@emnapi/runtime": "^1.7.1" } }, "sha512-3NQNNgA1YSlJb/kMH1ildASP9HW7/7kYnRI2szWJaofaS1hWmbGI4H+d3+22aGzXXN9IJ+n+GiFVcGipJP18ow=="],
|
||||||
|
|||||||
+2
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "md-blog",
|
"name": "md-blog",
|
||||||
"version": "1.3.0",
|
"version": "1.9.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"repository": "https://github.com/klemek/md-blog",
|
"repository": "https://github.com/klemek/md-blog",
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
"format": "prettier --write src/ *.ts *.json"
|
"format": "prettier --write src/ *.ts *.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@keithclark/shaderview": "git+https://github.com/keithclark/shaderview",
|
||||||
"highlight.js": "^11.11.1",
|
"highlight.js": "^11.11.1",
|
||||||
"katex": "^0.16.45",
|
"katex": "^0.16.45",
|
||||||
"lucide": "^1.11.0",
|
"lucide": "^1.11.0",
|
||||||
|
|||||||
+8
-23
@@ -1,29 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import hljs from 'highlight.js'
|
import { defineAsyncComponent } from 'vue'
|
||||||
import { createIcons, icons } from 'lucide'
|
|
||||||
import { onMounted, onUpdated, nextTick } from 'vue'
|
|
||||||
import mermaid from 'mermaid'
|
|
||||||
|
|
||||||
async function update() {
|
const NavBar = defineAsyncComponent(() => import('@components/NavBar.vue'))
|
||||||
setTimeout(async () => {
|
const PageFooter = defineAsyncComponent(() => import('@components/PageFooter.vue'))
|
||||||
await nextTick()
|
|
||||||
hljs.highlightAll()
|
|
||||||
createIcons({
|
|
||||||
icons,
|
|
||||||
nameAttr: 'icon',
|
|
||||||
attrs: {
|
|
||||||
width: '1.1em',
|
|
||||||
height: '1.1em',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
mermaid.run()
|
|
||||||
}, 100)
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(update)
|
|
||||||
onUpdated(update)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<RouterView @vue:mounted="update" @vue:updated="update" />
|
<main>
|
||||||
|
<NavBar />
|
||||||
|
<RouterView />
|
||||||
|
<PageFooter />
|
||||||
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { BACK_LINK } from '@lib/config'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<template v-if="$route.fullPath != '/'">
|
||||||
|
<RouterLink class="link-back" to="/"><span v-html="BACK_LINK"></span></RouterLink>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { BASE_URL, TITLE, RSS_LINK, ABOUT_LINK } from '@lib/config'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<nav>
|
||||||
|
<RouterLink to="/" class="nav-title"><span v-html="TITLE"></span></RouterLink>
|
||||||
|
<span class="nav-items">
|
||||||
|
<RouterLink to="/about/"><span v-html="ABOUT_LINK"></span></RouterLink>
|
||||||
|
<a :href="BASE_URL + 'atom.xml'" v-html="RSS_LINK"></a>
|
||||||
|
</span>
|
||||||
|
</nav>
|
||||||
|
</template>
|
||||||
@@ -1,16 +1,12 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { REPOSITORY, NAME, VERSION, BASE_URL, TITLE, COPYRIGHT } from '@/lib/meta'
|
import { REPOSITORY, NAME, VERSION, TITLE, COPYRIGHT } from '@lib/config'
|
||||||
import { stripHTML } from '@/lib/strings';
|
import { stripHTML } from '@lib/strings'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<template v-if="$route.fullPath != '/'">
|
|
||||||
<RouterLink to="/"><i icon="undo-2"></i> Back to home</RouterLink>
|
|
||||||
</template>
|
|
||||||
<hr />
|
|
||||||
<footer>
|
<footer>
|
||||||
{{ stripHTML(TITLE) }} © {{ new Date().getFullYear() }}, <span v-html="COPYRIGHT"></span> | Made with
|
{{ stripHTML(TITLE) }} © {{ new Date().getFullYear() }}, <span v-html="COPYRIGHT"></span> |
|
||||||
<a :href="REPOSITORY">{{ NAME }} {{ VERSION }}</a> |
|
Made with
|
||||||
<a :href="BASE_URL + 'atom.xml'"><i icon="rss"></i> RSS</a>
|
<a :href="REPOSITORY">{{ NAME }} {{ VERSION }}</a>
|
||||||
</footer>
|
</footer>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
+2
-1
@@ -7,7 +7,8 @@ export interface ArticleMetadata {
|
|||||||
path: string
|
path: string
|
||||||
title: string
|
title: string
|
||||||
date: Date
|
date: Date
|
||||||
author: string
|
updated?: Date
|
||||||
|
author?: string
|
||||||
thumbnail?: string
|
thumbnail?: string
|
||||||
draft?: boolean
|
draft?: boolean
|
||||||
}
|
}
|
||||||
|
|||||||
+28
-3
@@ -1,17 +1,42 @@
|
|||||||
import type { MarkdownData, Article, ArticleMetadata } from '@interfaces'
|
import type { MarkdownData, Article, ArticleMetadata } from '@interfaces'
|
||||||
import katex from 'katex'
|
import katex from 'katex'
|
||||||
|
import { nextTick } from 'vue'
|
||||||
|
import hljs from 'highlight.js'
|
||||||
|
import mermaid from 'mermaid'
|
||||||
|
import { createIcons, icons } from 'lucide'
|
||||||
|
|
||||||
|
export async function updateDynamicContent() {
|
||||||
|
await nextTick()
|
||||||
|
hljs.highlightAll()
|
||||||
|
createIcons({
|
||||||
|
icons,
|
||||||
|
nameAttr: 'icon',
|
||||||
|
attrs: {
|
||||||
|
width: '1.1em',
|
||||||
|
height: '1.1em',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
mermaid.run()
|
||||||
|
}
|
||||||
|
|
||||||
function parseMetadata(
|
function parseMetadata(
|
||||||
srcAttributes: Record<string, unknown>,
|
srcAttributes: Record<string, unknown>,
|
||||||
pathPrefix: string,
|
pathPrefix: string,
|
||||||
): ArticleMetadata {
|
): ArticleMetadata {
|
||||||
|
const draft = !!srcAttributes.draft
|
||||||
return {
|
return {
|
||||||
path: pathPrefix,
|
path: pathPrefix,
|
||||||
title: decodeURIComponent((srcAttributes.title as string) ?? 'Untitled'),
|
title:
|
||||||
date: new Date(Date.parse((srcAttributes.date as string) ?? '')),
|
(draft ? '[DRAFT] ' : '') + decodeURIComponent((srcAttributes.title as string) ?? 'Untitled'),
|
||||||
|
date: (srcAttributes.date as string | undefined)
|
||||||
|
? new Date(Date.parse(srcAttributes.date as string))
|
||||||
|
: new Date(),
|
||||||
|
updated: (srcAttributes.updated as string | undefined)
|
||||||
|
? new Date(Date.parse(srcAttributes.updated as string))
|
||||||
|
: undefined,
|
||||||
author: decodeURIComponent((srcAttributes.author as string) ?? ''),
|
author: decodeURIComponent((srcAttributes.author as string) ?? ''),
|
||||||
thumbnail: (srcAttributes.thumbnail as string) ?? '',
|
thumbnail: (srcAttributes.thumbnail as string) ?? '',
|
||||||
draft: !!srcAttributes.draft,
|
draft: draft,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import packageJson from '@/../package.json'
|
||||||
|
import articlesConfig from '@articles/config.json'
|
||||||
|
|
||||||
|
export const NAME: string = packageJson.name
|
||||||
|
export const VERSION: string = packageJson.version
|
||||||
|
export const REPOSITORY: string = packageJson.repository
|
||||||
|
export const TITLE: string = articlesConfig['title']
|
||||||
|
export const SIGNATURE: string = articlesConfig['signature']
|
||||||
|
export const COPYRIGHT: string = articlesConfig['copyright']
|
||||||
|
export const RSS_LINK: string = articlesConfig['rss_link']
|
||||||
|
export const BACK_LINK: string = articlesConfig['back_link']
|
||||||
|
export const ABOUT_LINK: string = articlesConfig['about_link']
|
||||||
|
export const HOME_COUNT: number = articlesConfig['home_count']
|
||||||
|
export const PUBLISHED_ON: string = articlesConfig['published_on']
|
||||||
|
export const UPDATED_ON: string = articlesConfig['updated_on']
|
||||||
|
export const AUTHORED: string = articlesConfig['authored']
|
||||||
|
export const BASE_URL: string = import.meta.env.BASE_URL
|
||||||
|
export const PROD: boolean = import.meta.env.PROD
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import packageJson from '@/../package.json'
|
|
||||||
|
|
||||||
export const NAME = packageJson.name
|
|
||||||
export const VERSION = packageJson.version
|
|
||||||
export const REPOSITORY = packageJson.repository
|
|
||||||
export const TITLE = import.meta.env.VITE_APP_TITLE
|
|
||||||
export const SIGNATURE = import.meta.env.VITE_APP_SIGNATURE
|
|
||||||
export const COPYRIGHT = import.meta.env.VITE_APP_COPYRIGHT
|
|
||||||
export const BASE_URL = import.meta.env.BASE_URL
|
|
||||||
@@ -2,6 +2,9 @@ import { createApp } from 'vue'
|
|||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
|
|
||||||
|
import ShaderviewElement from '@keithclark/shaderview'
|
||||||
|
customElements.define('kc-shaderview', ShaderviewElement)
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
|
||||||
app.use(router)
|
app.use(router)
|
||||||
|
|||||||
+7
-3
@@ -1,12 +1,16 @@
|
|||||||
import ArticleView from '@views/ArticleView.vue'
|
import { defineAsyncComponent } from 'vue'
|
||||||
import HomeView from '@views/HomeView.vue'
|
|
||||||
import NotFoundView from '@views/NotFoundView.vue'
|
|
||||||
import { createRouter, createWebHistory } from 'vue-router'
|
import { createRouter, createWebHistory } from 'vue-router'
|
||||||
|
|
||||||
|
const AboutView = defineAsyncComponent(() => import('@views/AboutView.vue'))
|
||||||
|
const ArticleView = defineAsyncComponent(() => import('@views/ArticleView.vue'))
|
||||||
|
const HomeView = defineAsyncComponent(() => import('@views/HomeView.vue'))
|
||||||
|
const NotFoundView = defineAsyncComponent(() => import('@views/NotFoundView.vue'))
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(),
|
history: createWebHistory(),
|
||||||
routes: [
|
routes: [
|
||||||
{ path: '/', component: HomeView },
|
{ path: '/', component: HomeView },
|
||||||
|
{ path: '/about/', component: AboutView },
|
||||||
{ path: '/articles/:pathMatch(.*)/', component: ArticleView },
|
{ path: '/articles/:pathMatch(.*)/', component: ArticleView },
|
||||||
{ path: '/:pathMatch(.*)', component: NotFoundView },
|
{ path: '/:pathMatch(.*)', component: NotFoundView },
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ABOUT_LINK, TITLE } from '@lib/config'
|
||||||
|
import { stripHTML } from '@lib/strings'
|
||||||
|
import { onBeforeMount, onMounted, onUpdated, ref } from 'vue'
|
||||||
|
import { updateDynamicContent } from '@lib/articles'
|
||||||
|
import BackHomeButton from '@components/BackHomeButton.vue'
|
||||||
|
|
||||||
|
const loading = ref<boolean>(true)
|
||||||
|
const html = ref<string>('')
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
window.document.title = stripHTML(TITLE) + ' — ' + stripHTML(ABOUT_LINK)
|
||||||
|
html.value = (await import('@articles/about.md')).html
|
||||||
|
loading.value = false
|
||||||
|
await updateDynamicContent()
|
||||||
|
})
|
||||||
|
onMounted(updateDynamicContent)
|
||||||
|
onUpdated(updateDynamicContent)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div v-if="!loading" class="article">
|
||||||
|
<div v-html="html"></div>
|
||||||
|
<BackHomeButton />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
+24
-19
@@ -1,13 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Article } from '@interfaces'
|
import type { Article } from '@interfaces'
|
||||||
import { ref, onBeforeMount } from 'vue'
|
import { ref, onBeforeMount, onUpdated, onMounted, defineAsyncComponent } from 'vue'
|
||||||
import { loadArticle } from '@lib/articles'
|
import { loadArticle, updateDynamicContent } from '@lib/articles'
|
||||||
import { useRoute, onBeforeRouteUpdate, type RouteLocation } from 'vue-router'
|
import { useRoute, onBeforeRouteUpdate, type RouteLocation } from 'vue-router'
|
||||||
import NotFoundView from './NotFoundView.vue'
|
|
||||||
import { simpleDateFormat } from '@lib/dates'
|
import { simpleDateFormat } from '@lib/dates'
|
||||||
import { SIGNATURE, TITLE } from '@lib/meta'
|
import { AUTHORED, PUBLISHED_ON, SIGNATURE, TITLE, UPDATED_ON } from '@lib/config'
|
||||||
import PageFooter from '@components/PageFooter.vue'
|
import { stripHTML } from '@lib/strings'
|
||||||
import { stripHTML } from '@/lib/strings'
|
|
||||||
|
const BackHomeButton = defineAsyncComponent(() => import('@components/BackHomeButton.vue'))
|
||||||
|
const NotFoundView = defineAsyncComponent(() => import('@views/NotFoundView.vue'))
|
||||||
|
|
||||||
const article = ref<Article | null>(null)
|
const article = ref<Article | null>(null)
|
||||||
const loading = ref<boolean>(true)
|
const loading = ref<boolean>(true)
|
||||||
@@ -19,27 +20,32 @@ async function loadPage(target: RouteLocation) {
|
|||||||
window.document.title =
|
window.document.title =
|
||||||
stripHTML(TITLE) + ' — ' + stripHTML(article.value?.metadata.title ?? 'Not Found')
|
stripHTML(TITLE) + ' — ' + stripHTML(article.value?.metadata.title ?? 'Not Found')
|
||||||
loading.value = false
|
loading.value = false
|
||||||
|
await updateDynamicContent()
|
||||||
}
|
}
|
||||||
|
|
||||||
onBeforeMount(() => loadPage(route))
|
onBeforeMount(() => loadPage(route))
|
||||||
onBeforeRouteUpdate(loadPage)
|
onBeforeRouteUpdate(loadPage)
|
||||||
|
onMounted(updateDynamicContent)
|
||||||
|
onUpdated(updateDynamicContent)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<template v-if="loading">
|
<template v-if="!loading && !article">
|
||||||
<main></main>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="!article">
|
|
||||||
<NotFoundView />
|
<NotFoundView />
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<div v-if="!loading" class="article">
|
||||||
<main class="article">
|
<template v-if="!loading && article">
|
||||||
<div class="article-header">
|
<div class="article-header">
|
||||||
<RouterLink class="link-home" to="/"><i icon="undo-2">↑</i></RouterLink>
|
|
||||||
<h1 class="article-title" v-html="article.metadata.title"></h1>
|
<h1 class="article-title" v-html="article.metadata.title"></h1>
|
||||||
<div class="article-published">
|
<div class="article-info">
|
||||||
{{ article.metadata.draft ? 'Drafted on' : 'Published on' }}
|
<span v-if="article.metadata.author"
|
||||||
{{ simpleDateFormat(article.metadata.date) }}
|
><span v-html="AUTHORED"></span> <span v-html="article.metadata.author"></span> —
|
||||||
|
</span>
|
||||||
|
<span v-html="PUBLISHED_ON"></span> {{ simpleDateFormat(article.metadata.date) }}
|
||||||
|
<span v-if="article.metadata.updated"
|
||||||
|
>— <span v-html="UPDATED_ON"></span>
|
||||||
|
{{ simpleDateFormat(article.metadata.updated) }}</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<img
|
<img
|
||||||
v-if="article.metadata.thumbnail"
|
v-if="article.metadata.thumbnail"
|
||||||
@@ -50,8 +56,7 @@ onBeforeRouteUpdate(loadPage)
|
|||||||
</div>
|
</div>
|
||||||
<div class="article-text" v-html="article.html"></div>
|
<div class="article-text" v-html="article.html"></div>
|
||||||
<div class="article-signature" v-html="SIGNATURE"></div>
|
<div class="article-signature" v-html="SIGNATURE"></div>
|
||||||
<br />
|
<BackHomeButton />
|
||||||
<PageFooter />
|
|
||||||
</main>
|
|
||||||
</template>
|
</template>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
+18
-12
@@ -1,29 +1,36 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onBeforeMount } from 'vue'
|
import { ref, onBeforeMount, onUpdated, onMounted } from 'vue'
|
||||||
import { listArticles } from '@lib/articles'
|
import { listArticles, updateDynamicContent } from '@lib/articles'
|
||||||
import type { ArticleMetadata } from '@interfaces'
|
import type { ArticleMetadata } from '@interfaces'
|
||||||
import { simpleDateFormat } from '@lib/dates'
|
import { simpleDateFormat } from '@lib/dates'
|
||||||
import { TITLE } from '@lib/meta'
|
import { HOME_COUNT, PROD, PUBLISHED_ON, TITLE } from '@lib/config'
|
||||||
import PageFooter from '@components/PageFooter.vue'
|
import { stripHTML } from '@lib/strings'
|
||||||
import { stripHTML } from '@/lib/strings'
|
|
||||||
|
|
||||||
const articles = ref<ArticleMetadata[]>([])
|
const articles = ref<ArticleMetadata[]>([])
|
||||||
|
const loading = ref<boolean>(true)
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
const newArticles = await listArticles()
|
const newArticles = (await listArticles())
|
||||||
|
.filter((metadata) => (!metadata.draft || !PROD) && metadata.path)
|
||||||
|
.slice(0, HOME_COUNT)
|
||||||
articles.value.splice(0, articles.value.length, ...newArticles)
|
articles.value.splice(0, articles.value.length, ...newArticles)
|
||||||
window.document.title = stripHTML(TITLE) + ' — Home'
|
window.document.title = stripHTML(TITLE) + ' — Home'
|
||||||
|
loading.value = false
|
||||||
|
await updateDynamicContent()
|
||||||
})
|
})
|
||||||
|
onMounted(updateDynamicContent)
|
||||||
|
onUpdated(updateDynamicContent)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<main>
|
<div v-if="!loading" class="home">
|
||||||
<h1 class="title" v-html="TITLE"></h1>
|
|
||||||
<template v-for="(metadata, index) in articles" v-bind:key="index">
|
<template v-for="(metadata, index) in articles" v-bind:key="index">
|
||||||
<div v-if="!metadata.draft && metadata.path" class="article-item">
|
<div v-if="(!metadata.draft || !PROD) && metadata.path" class="article-item">
|
||||||
<RouterLink :to="metadata.path">
|
<RouterLink :to="metadata.path">
|
||||||
<h2 v-html="metadata.title"></h2>
|
<h2 v-html="metadata.title"></h2>
|
||||||
<span class="article-published">Published on {{ simpleDateFormat(metadata.date) }}</span>
|
<span class="article-info"
|
||||||
|
><span v-html="PUBLISHED_ON"></span> {{ simpleDateFormat(metadata.date) }}</span
|
||||||
|
>
|
||||||
<img
|
<img
|
||||||
v-if="metadata.thumbnail"
|
v-if="metadata.thumbnail"
|
||||||
alt="thumbnail"
|
alt="thumbnail"
|
||||||
@@ -32,6 +39,5 @@ onBeforeMount(async () => {
|
|||||||
</RouterLink>
|
</RouterLink>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<PageFooter />
|
</div>
|
||||||
</main>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
+15
-10
@@ -1,17 +1,22 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { TITLE } from '@/lib/meta'
|
import { TITLE } from '@lib/config'
|
||||||
import { stripHTML } from '@/lib/strings'
|
import { stripHTML } from '@lib/strings'
|
||||||
import PageFooter from '@components/PageFooter.vue'
|
import { onBeforeMount, onMounted, onUpdated, ref } from 'vue'
|
||||||
import { onBeforeMount } from 'vue'
|
import { updateDynamicContent } from '@lib/articles'
|
||||||
|
|
||||||
onBeforeMount(() => {
|
const loading = ref<boolean>(true)
|
||||||
window.document.title = stripHTML(TITLE) + ' — Not Found'
|
const html = ref<string>('')
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
window.document.title = stripHTML(TITLE)
|
||||||
|
html.value = (await import('@articles/not_found.md')).html
|
||||||
|
loading.value = false
|
||||||
|
await updateDynamicContent()
|
||||||
})
|
})
|
||||||
|
onMounted(updateDynamicContent)
|
||||||
|
onUpdated(updateDynamicContent)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<main>
|
<div v-if="!loading" class="article" v-html="html"></div>
|
||||||
<h1>Page not found</h1>
|
|
||||||
<PageFooter />
|
|
||||||
</main>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -14,9 +14,7 @@ export default ({ mode }: { mode: string }) => {
|
|||||||
process.env.VITE_APP_TITLE = articlesConfig['title']
|
process.env.VITE_APP_TITLE = articlesConfig['title']
|
||||||
process.env.VITE_APP_TITLE_NO_HTML = articlesConfig['title'].replace(/(<([^>]+)>)/gi, '').trim()
|
process.env.VITE_APP_TITLE_NO_HTML = articlesConfig['title'].replace(/(<([^>]+)>)/gi, '').trim()
|
||||||
process.env.VITE_APP_LANG = articlesConfig['lang']
|
process.env.VITE_APP_LANG = articlesConfig['lang']
|
||||||
process.env.VITE_APP_SIGNATURE = articlesConfig['signature']
|
|
||||||
process.env.VITE_CUSTOM_HEAD = articlesConfig['custom_head']
|
process.env.VITE_CUSTOM_HEAD = articlesConfig['custom_head']
|
||||||
process.env.VITE_APP_COPYRIGHT = articlesConfig['copyright']
|
|
||||||
|
|
||||||
return defineConfig({
|
return defineConfig({
|
||||||
plugins: [vue(), vueDevTools(), mdPlugin({ mode: [Mode.HTML] })],
|
plugins: [vue(), vueDevTools(), mdPlugin({ mode: [Mode.HTML] })],
|
||||||
|
|||||||
Reference in New Issue
Block a user