mirror of
https://github.com/saicaca/fuwari.git
synced 2026-01-12 07:12:52 +01:00
fix: fix errors and reformat code
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
---
|
||||
|
||||
import MainGridLayout from "../layouts/MainGridLayout.astro";
|
||||
import MainGridLayout from '../layouts/MainGridLayout.astro'
|
||||
|
||||
import { getEntry } from 'astro:content'
|
||||
import {i18n} from "../i18n/translation";
|
||||
import I18nKey from "../i18n/i18nKey";
|
||||
import Markdown from "@components/misc/Markdown.astro";
|
||||
import { i18n } from '../i18n/translation'
|
||||
import I18nKey from '../i18n/i18nKey'
|
||||
import Markdown from '@components/misc/Markdown.astro'
|
||||
|
||||
const aboutPost = await getEntry('spec', 'about')
|
||||
|
||||
const { Content } = await aboutPost.render()
|
||||
|
||||
---
|
||||
<MainGridLayout title={i18n(I18nKey.about)} description={i18n(I18nKey.about)}>
|
||||
<div class="flex w-full rounded-[var(--radius-large)] overflow-hidden relative min-h-32">
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
---
|
||||
import {getCategoryList} from "@utils/content-utils";
|
||||
import MainGridLayout from "@layouts/MainGridLayout.astro";
|
||||
import ArchivePanel from "@components/ArchivePanel.astro";
|
||||
import {i18n} from "@i18n/translation";
|
||||
import I18nKey from "@i18n/i18nKey";
|
||||
import { getCategoryList } from '@utils/content-utils'
|
||||
import MainGridLayout from '@layouts/MainGridLayout.astro'
|
||||
import ArchivePanel from '@components/ArchivePanel.astro'
|
||||
import { i18n } from '@i18n/translation'
|
||||
import I18nKey from '@i18n/i18nKey'
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const categories = await getCategoryList();
|
||||
return categories.map(category => {
|
||||
return {
|
||||
params: {
|
||||
category: category.name
|
||||
}
|
||||
}
|
||||
});
|
||||
const categories = await getCategoryList()
|
||||
return categories.map(category => {
|
||||
return {
|
||||
params: {
|
||||
category: category.name,
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const category = Astro.params.category as string;
|
||||
|
||||
const category = Astro.params.category as string
|
||||
---
|
||||
|
||||
<MainGridLayout title={i18n(I18nKey.archive)} description={i18n(I18nKey.archive)}>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
import MainGridLayout from "@layouts/MainGridLayout.astro";
|
||||
import ArchivePanel from "@components/ArchivePanel.astro";
|
||||
import {i18n} from "@i18n/translation";
|
||||
import I18nKey from "@i18n/i18nKey";
|
||||
import {UNCATEGORIZED} from "@constants/constants";
|
||||
import MainGridLayout from '@layouts/MainGridLayout.astro'
|
||||
import ArchivePanel from '@components/ArchivePanel.astro'
|
||||
import { i18n } from '@i18n/translation'
|
||||
import I18nKey from '@i18n/i18nKey'
|
||||
import { UNCATEGORIZED } from '@constants/constants'
|
||||
---
|
||||
|
||||
<MainGridLayout title={i18n(I18nKey.archive)}>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
import MainGridLayout from "@layouts/MainGridLayout.astro";
|
||||
import ArchivePanel from "@components/ArchivePanel.astro";
|
||||
import {i18n} from "@i18n/translation";
|
||||
import I18nKey from "@i18n/i18nKey";
|
||||
import MainGridLayout from '@layouts/MainGridLayout.astro'
|
||||
import ArchivePanel from '@components/ArchivePanel.astro'
|
||||
import { i18n } from '@i18n/translation'
|
||||
import I18nKey from '@i18n/i18nKey'
|
||||
---
|
||||
|
||||
<MainGridLayout title={i18n(I18nKey.archive)}>
|
||||
|
||||
@@ -1,31 +1,30 @@
|
||||
---
|
||||
import {getSortedPosts} from "@utils/content-utils";
|
||||
import MainGridLayout from "@layouts/MainGridLayout.astro";
|
||||
import ArchivePanel from "@components/ArchivePanel.astro";
|
||||
import {i18n} from "@i18n/translation";
|
||||
import I18nKey from "@i18n/i18nKey";
|
||||
import { getSortedPosts } from '@utils/content-utils'
|
||||
import MainGridLayout from '@layouts/MainGridLayout.astro'
|
||||
import ArchivePanel from '@components/ArchivePanel.astro'
|
||||
import { i18n } from '@i18n/translation'
|
||||
import I18nKey from '@i18n/i18nKey'
|
||||
|
||||
export async function getStaticPaths() {
|
||||
let posts = await getSortedPosts()
|
||||
let posts = await getSortedPosts()
|
||||
|
||||
const allTags = posts.reduce((acc, post) => {
|
||||
post.data.tags.forEach(tag => acc.add(tag));
|
||||
return acc;
|
||||
}, new Set());
|
||||
const allTags = posts.reduce((acc, post) => {
|
||||
post.data.tags.forEach(tag => acc.add(tag))
|
||||
return acc
|
||||
}, new Set())
|
||||
|
||||
const allTagsArray = Array.from(allTags);
|
||||
const allTagsArray = Array.from(allTags)
|
||||
|
||||
return allTagsArray.map(tag => {
|
||||
return {
|
||||
params: {
|
||||
tag: tag
|
||||
}
|
||||
}
|
||||
});
|
||||
return allTagsArray.map(tag => {
|
||||
return {
|
||||
params: {
|
||||
tag: tag,
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const tag= Astro.params.tag as string;
|
||||
|
||||
const tag = Astro.params.tag as string
|
||||
---
|
||||
|
||||
<MainGridLayout title={i18n(I18nKey.archive)} description={i18n(I18nKey.archive)}>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import type { APIRoute } from 'astro';
|
||||
import type { APIRoute } from 'astro'
|
||||
|
||||
const robotsTxt = `
|
||||
User-agent: *
|
||||
Allow: /
|
||||
|
||||
Sitemap: ${new URL('sitemap-index.xml', import.meta.env.SITE).href}
|
||||
`.trim();
|
||||
`.trim()
|
||||
|
||||
export const GET: APIRoute = () => {
|
||||
return new Response(robotsTxt, {
|
||||
headers: {
|
||||
'Content-Type': 'text/plain; charset=utf-8',
|
||||
},
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
import rss from '@astrojs/rss';
|
||||
import {siteConfig} from '@/config';
|
||||
import sanitizeHtml from 'sanitize-html';
|
||||
import MarkdownIt from 'markdown-it';
|
||||
import {getSortedPosts} from "@utils/content-utils.ts";
|
||||
const parser = new MarkdownIt();
|
||||
import rss from '@astrojs/rss'
|
||||
import { siteConfig } from '@/config'
|
||||
import sanitizeHtml from 'sanitize-html'
|
||||
import MarkdownIt from 'markdown-it'
|
||||
import { getSortedPosts } from '@utils/content-utils.ts'
|
||||
const parser = new MarkdownIt()
|
||||
|
||||
export async function GET(context: any) {
|
||||
const blog = await getSortedPosts();
|
||||
const blog = await getSortedPosts()
|
||||
return rss({
|
||||
title: siteConfig.title,
|
||||
description: siteConfig.subtitle || 'No description',
|
||||
site: context.site,
|
||||
items: blog.map((post) => ({
|
||||
title: post.data.title,
|
||||
pubDate: post.data.published,
|
||||
description: post.data.description,
|
||||
link: `/posts/${post.slug}/`,
|
||||
content: sanitizeHtml(parser.render(post.body), {
|
||||
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img'])
|
||||
}),
|
||||
})),
|
||||
items: blog.map(post => ({
|
||||
title: post.data.title,
|
||||
pubDate: post.data.published,
|
||||
description: post.data.description,
|
||||
link: `/posts/${post.slug}/`,
|
||||
content: sanitizeHtml(parser.render(post.body), {
|
||||
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img']),
|
||||
}),
|
||||
})),
|
||||
customData: `<language>${siteConfig.lang}</language>`,
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user