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;
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"${
title ? ` title="${title}"` : ''
}>${text}</a>`;
@ -39,7 +43,7 @@ async function readBlogPosts() {
readFiles.sort((a, b) =>
new Date(b.date)
.toISOString()
.localeCompare(new Date(a.date).toISOString(), 'en', { numeric: true })
.localeCompare(new Date(a.date).toISOString(), 'en', { numeric: true }),
);
return readFiles;
@ -86,7 +90,7 @@ export const blogPostList = async () => {
export const getFilteredBlogPosts = async (
condition?: (body: BlogPost) => boolean,
htmlContent = true,
includeMarkdown = true
includeMarkdown = true,
): Promise<BlogPost[]> => {
const posts = await blogPostList();
return posts
@ -101,7 +105,7 @@ export const getFilteredBlogPosts = async (
export const getBlogPost = async (
slug: string,
htmlContent = true,
includeMarkdown = true
includeMarkdown = true,
): Promise<BlogPost | undefined> => {
const posts = await blogPostList();
const item = posts.find((item) => item.slug === slug);

View File

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

8194
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -67,7 +67,7 @@
variant="right"
title="Various web-based games"
image="/images/projects/games.png"
href="/apps"
href="https://lunasqu.ee/apps"
>
<p>
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) => {
const slug = getRouterParam(event, 'slug');
try {
const post = await getBlogPost(slug);
const post = await getBlogPost(slug as string);
return post;
} catch (e) {}
});

View File

@ -10,10 +10,10 @@ export default defineEventHandler(async (event) => {
description: 'Projects and Tutorials',
id: BASE_URL,
link: BASE_URL,
copyright: 'Evert "Diamond" Prants 2022',
copyright: 'Evert "Diamond" Prants 2023',
language: 'en',
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: {
atom: `${BASE_URL}/atom.xml`,
},