This commit is contained in:
Evert Prants 2023-09-22 18:01:40 +03:00
parent 249aa17ce5
commit 4bf01118cc
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
7 changed files with 4311 additions and 3919 deletions

View File

@ -17,7 +17,11 @@ marked.use({
const created = hljs.highlight(code, { language }).value; const created = hljs.highlight(code, { language }).value;
return `<div class="codeblock"><pre><code class="hljs language-${language}">${created}</code></pre></div>`; return `<div class="codeblock"><pre><code class="hljs language-${language}">${created}</code></pre></div>`;
}, },
link: (href: string, title: string, text: string): string => { link: (
href: string,
title: string | undefined | null,
text: string,
): string => {
return `<a href="${href}" rel="nofollow" target="_blank"${ return `<a href="${href}" rel="nofollow" target="_blank"${
title ? ` title="${title}"` : '' title ? ` title="${title}"` : ''
}>${text}</a>`; }>${text}</a>`;
@ -39,7 +43,7 @@ async function readBlogPosts() {
readFiles.sort((a, b) => readFiles.sort((a, b) =>
new Date(b.date) new Date(b.date)
.toISOString() .toISOString()
.localeCompare(new Date(a.date).toISOString(), 'en', { numeric: true }) .localeCompare(new Date(a.date).toISOString(), 'en', { numeric: true }),
); );
return readFiles; return readFiles;
@ -86,7 +90,7 @@ export const blogPostList = async () => {
export const getFilteredBlogPosts = async ( export const getFilteredBlogPosts = async (
condition?: (body: BlogPost) => boolean, condition?: (body: BlogPost) => boolean,
htmlContent = true, htmlContent = true,
includeMarkdown = true includeMarkdown = true,
): Promise<BlogPost[]> => { ): Promise<BlogPost[]> => {
const posts = await blogPostList(); const posts = await blogPostList();
return posts return posts
@ -101,7 +105,7 @@ export const getFilteredBlogPosts = async (
export const getBlogPost = async ( export const getBlogPost = async (
slug: string, slug: string,
htmlContent = true, htmlContent = true,
includeMarkdown = true includeMarkdown = true,
): Promise<BlogPost | undefined> => { ): Promise<BlogPost | undefined> => {
const posts = await blogPostList(); const posts = await blogPostList();
const item = posts.find((item) => item.slug === slug); const item = posts.find((item) => item.slug === slug);

View File

@ -37,7 +37,7 @@ export default defineNuxtConfig({
hooks: { hooks: {
async 'nitro:config'(config) { async 'nitro:config'(config) {
const routes = await generatePaths('/blog/'); const routes = await generatePaths('/blog/');
config.prerender.routes.push(...routes, '/blog/atom.xml'); config.prerender?.routes?.push(...routes, '/blog/atom.xml');
}, },
}, },
}); });

8186
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -8,15 +8,15 @@
"postinstall": "nuxt prepare" "postinstall": "nuxt prepare"
}, },
"devDependencies": { "devDependencies": {
"@types/marked": "^4.0.8", "@types/marked": "^5.0.1",
"marked": "^4.3.0", "marked": "^9.0.3",
"nuxt": "^3.3.3", "nuxt": "^3.7.3",
"prettier": "^2.8.7", "prettier": "^3.0.3",
"yaml": "^2.2.1" "yaml": "^2.3.2"
}, },
"dependencies": { "dependencies": {
"feed": "^4.2.2", "feed": "^4.2.2",
"highlight.js": "^11.7.0", "highlight.js": "^11.8.0",
"sass": "^1.60.0" "sass": "^1.68.0"
} }
} }

View File

@ -67,7 +67,7 @@
variant="right" variant="right"
title="Various web-based games" title="Various web-based games"
image="/images/projects/games.png" image="/images/projects/games.png"
href="/apps" href="https://lunasqu.ee/apps"
> >
<p> <p>
I have also created various experimental web-based games in order to I have also created various experimental web-based games in order to

View File

@ -3,7 +3,7 @@ import { getBlogPost } from '~~/lib/blog/read-posts';
export default defineEventHandler(async (event) => { export default defineEventHandler(async (event) => {
const slug = getRouterParam(event, 'slug'); const slug = getRouterParam(event, 'slug');
try { try {
const post = await getBlogPost(slug); const post = await getBlogPost(slug as string);
return post; return post;
} catch (e) {} } catch (e) {}
}); });

View File

@ -10,10 +10,10 @@ export default defineEventHandler(async (event) => {
description: 'Projects and Tutorials', description: 'Projects and Tutorials',
id: BASE_URL, id: BASE_URL,
link: BASE_URL, link: BASE_URL,
copyright: 'Evert "Diamond" Prants 2022', copyright: 'Evert "Diamond" Prants 2023',
language: 'en', language: 'en',
updated: new Date(posts[0].date), updated: new Date(posts[0].date),
generator: 'https://gitlab.icynet.eu/evert/lunasqu.ee-nuxt', generator: 'https://git.icynet.eu/evert/lunasqu.ee-nuxt',
feedLinks: { feedLinks: {
atom: `${BASE_URL}/atom.xml`, atom: `${BASE_URL}/atom.xml`,
}, },