First release.
This commit is contained in:
commit
f04ca4a96b
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# build output
|
||||
dist/
|
||||
|
||||
# generated types
|
||||
.astro/
|
||||
|
||||
# dependencies
|
||||
node_modules/
|
||||
|
||||
# logs
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# environment variables
|
||||
.env
|
||||
.env.production
|
||||
|
||||
# macOS-specific files
|
||||
.DS_Store
|
||||
|
||||
# jetbrains setting folder
|
||||
.idea/
|
4
.vscode/extensions.json
vendored
Normal file
4
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"recommendations": ["astro-build.astro-vscode"],
|
||||
"unwantedRecommendations": []
|
||||
}
|
11
.vscode/launch.json
vendored
Normal file
11
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"command": "./node_modules/.bin/astro dev",
|
||||
"name": "Development server",
|
||||
"request": "launch",
|
||||
"type": "node-terminal"
|
||||
}
|
||||
]
|
||||
}
|
40
astro.config.mjs
Normal file
40
astro.config.mjs
Normal file
@ -0,0 +1,40 @@
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
import sitemap from "@astrojs/sitemap";
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
markdown: {
|
||||
syntaxHighlight: 'shiki',
|
||||
shikiConfig: {
|
||||
// Choose from Shiki's built-in themes (or add your own)
|
||||
// https://shiki.style/themes
|
||||
theme: 'github-light',
|
||||
// Alternatively, provide multiple themes
|
||||
// See note below for using dual light/dark themes
|
||||
themes: {
|
||||
light: 'github-light',
|
||||
dark: 'github-dark'
|
||||
},
|
||||
// Add custom languages
|
||||
// Note: Shiki has countless langs built-in, including .astro!
|
||||
// https://shiki.style/languages
|
||||
langs: [],
|
||||
// Enable word wrap to prevent horizontal scrolling
|
||||
wrap: false,
|
||||
// Add custom transformers: https://shiki.style/guide/transformers
|
||||
// Find common transformers: https://shiki.style/packages/transformers
|
||||
transformers: []
|
||||
}
|
||||
},
|
||||
site: 'https://lishouzhong.com',
|
||||
integrations: [sitemap({
|
||||
// entryLimit: 10000,
|
||||
// customPages: [],
|
||||
// filter: (page) => { },
|
||||
// lastmod: new Date('2022-02-24'),
|
||||
// serialize(item) {
|
||||
// return item;
|
||||
// }
|
||||
})]
|
||||
});
|
6907
package-lock.json
generated
Normal file
6907
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
18
package.json
Normal file
18
package.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "ld-site",
|
||||
"type": "module",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev": "astro dev",
|
||||
"start": "astro dev",
|
||||
"build": "astro check && astro build",
|
||||
"preview": "astro preview",
|
||||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/check": "^0.7.0",
|
||||
"@astrojs/sitemap": "^3.1.5",
|
||||
"astro": "^4.9.2",
|
||||
"typescript": "^5.4.5"
|
||||
}
|
||||
}
|
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
4
public/robots.txt
Normal file
4
public/robots.txt
Normal file
@ -0,0 +1,4 @@
|
||||
User-agent: *
|
||||
Allow: /
|
||||
|
||||
Sitemap: https://lishouzhong.com/sitemap-index.xml
|
24
script/build_on_linux.sh
Normal file
24
script/build_on_linux.sh
Normal file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env sh
|
||||
# cron
|
||||
# 0 4 * * * . /etc/profile; /bin/sh /opt/ld-site/script/build_on_linux.sh >/dev/null 2>&1
|
||||
|
||||
export PATH=$PATH:/opt/dev_tools/node-v20.12.2-linux-x64/bin
|
||||
|
||||
script_path="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
original_article_home="/home/ld/Documents/ld_article"
|
||||
original_article_destination="/opt/ld-site/src/content"
|
||||
ld_site_dist_target="/opt/nginx_targets/ld_site_dist"
|
||||
|
||||
rsync -a "${original_article_home}/" "${original_article_destination}/"
|
||||
|
||||
cd "${script_path}/../"
|
||||
npm run build
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "cannot build ld_site."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mv ${ld_site_dist_target} "${ld_site_dist_target}-old"
|
||||
mv dist ${ld_site_dist_target}
|
||||
rm -rf "${ld_site_dist_target}-old" ${original_article_destination}
|
29
src/components/Footer.astro
Normal file
29
src/components/Footer.astro
Normal file
@ -0,0 +1,29 @@
|
||||
---
|
||||
---
|
||||
|
||||
<div class="footer">
|
||||
<hr />
|
||||
<div>
|
||||
<small class="contact">Contact: lsz.sino@outlook.com</small>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<small class="licence">若正文中无特殊说明,本站内容遵循:</small>
|
||||
<small class="licence">
|
||||
<a href="http://creativecommons.org/licenses/by-nc-sa/4.0/">
|
||||
署名-非商业使用-相同方式共享 4.0 国际许可协议
|
||||
</a>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.footer {
|
||||
margin-top: auto;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.contact,
|
||||
.licence {
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
13
src/components/HTMLCommonHead.astro
Normal file
13
src/components/HTMLCommonHead.astro
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
interface Props {
|
||||
title: string;
|
||||
}
|
||||
const { title } = Astro.props;
|
||||
---
|
||||
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<link rel="icon" href="/favicon.ico" type="image/x-icon">
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
<link rel="sitemap" href="/sitemap-index.xml" />
|
||||
<title>{title}</title>
|
51
src/components/Nav.astro
Normal file
51
src/components/Nav.astro
Normal file
@ -0,0 +1,51 @@
|
||||
---
|
||||
---
|
||||
|
||||
<div class="nav" id="nav">
|
||||
<span class="nav-item site-title" id="site-title">
|
||||
<a class="nav-link" href="/">李守中</a>
|
||||
</span>
|
||||
<span class="nav-item" id="category">
|
||||
<ul class="nav-list">
|
||||
<li class="nav-list-item">
|
||||
<a class="nav-link" href="/article/blog/">博客</a>
|
||||
</li>
|
||||
<li class="nav-list-item">
|
||||
<a class="nav-link" href="/article/note/">笔记</a>
|
||||
</li>
|
||||
<li class="nav-list-item">
|
||||
<a class="nav-link" href="/article/translation/">翻译</a>
|
||||
</li>
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.nav {
|
||||
font-size: 1em;
|
||||
margin: 10px 0 0 0;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
}
|
||||
#site-title {
|
||||
font-size: 1.8em;
|
||||
margin: 0 20px 0 0;
|
||||
padding: 0 0 2px 0;
|
||||
line-height: 100%;
|
||||
}
|
||||
.nav-list {
|
||||
padding: 0;
|
||||
margin: 0px;
|
||||
}
|
||||
.nav-list .nav-list-item {
|
||||
float: left;
|
||||
list-style-type: none;
|
||||
margin: 0 20px 0 0;
|
||||
}
|
||||
.nav-list .nav-list-item:last-child {
|
||||
margin: 0;
|
||||
}
|
||||
.nav-link {
|
||||
color: black;
|
||||
}
|
||||
</style>
|
71
src/components/article/ArticleBody.astro
Normal file
71
src/components/article/ArticleBody.astro
Normal file
@ -0,0 +1,71 @@
|
||||
---
|
||||
import { getEntry, type CollectionKey } from "astro:content";
|
||||
|
||||
interface Props {
|
||||
articleSlug: string;
|
||||
collectionName: CollectionKey;
|
||||
}
|
||||
const { articleSlug, collectionName } = Astro.props;
|
||||
|
||||
const article = await getEntry(collectionName, articleSlug);
|
||||
const { Content } = await article!.render();
|
||||
const articlePrettyName = article!.id.split("/").pop()!.replace(".md", "");
|
||||
---
|
||||
|
||||
<div class="article">
|
||||
<div class="article-title">
|
||||
<h1>{articlePrettyName} </h1>
|
||||
{
|
||||
article!.data.lastUpdate && (
|
||||
<span class="last-update">Last Update: {article!.data.lastUpdate}</span>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
<Content />
|
||||
</div>
|
||||
|
||||
<style>
|
||||
:global(.article img) {
|
||||
max-width: 100%;
|
||||
margin: auto;
|
||||
display: block;
|
||||
}
|
||||
:global(.article p) {
|
||||
margin: 1em 0 1em 0;
|
||||
}
|
||||
:global(.article > h1, h2, h3, h4, h5) {
|
||||
margin: 1em 0 1em 0;
|
||||
}
|
||||
:global(.article-title h1) {
|
||||
margin: 0.5em 0 0 0;
|
||||
}
|
||||
.article .article-title {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
/* reduce indent of TOC list */
|
||||
:global(.article-title + ul) {
|
||||
margin: 1em 0 1em 0;
|
||||
padding: 0 0 0 20px;
|
||||
}
|
||||
/* font for all code */
|
||||
:global(.article code) {
|
||||
font-family: "Consolas", "Tahoma", sans-serif;
|
||||
}
|
||||
/* code block */
|
||||
:global(.article pre) {
|
||||
border: 1px solid #eee;
|
||||
border-left: 6px solid #ccc;
|
||||
padding: 6px 6px 4px 6px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
/* inline code in paragraph*/
|
||||
:global(.article p code) {
|
||||
color: #be4750;
|
||||
}
|
||||
/* inline code in list item */
|
||||
:global(.article li > code) {
|
||||
color: #be4750;
|
||||
}
|
||||
</style>
|
33
src/components/article/CategorySummary.astro
Normal file
33
src/components/article/CategorySummary.astro
Normal file
@ -0,0 +1,33 @@
|
||||
---
|
||||
import type { CollectionEntry, CollectionKey } from "astro:content";
|
||||
|
||||
interface Props {
|
||||
collectionName: CollectionKey;
|
||||
categoryName: string;
|
||||
posts: Array<CollectionEntry<CollectionKey>>;
|
||||
}
|
||||
const { collectionName, categoryName, posts } = Astro.props;
|
||||
---
|
||||
|
||||
<h1>{categoryName}</h1>
|
||||
<ul>
|
||||
{
|
||||
posts.map((post) => (
|
||||
<li>
|
||||
<a href={`/article/${collectionName}/${post.slug}`} target="_blank">
|
||||
{post.data.title}
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
|
||||
<style>
|
||||
ul {
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
}
|
||||
h1 {
|
||||
margin: 0.5em 0 0 0;
|
||||
}
|
||||
</style>
|
94
src/components/article/CollectionSummary.astro
Normal file
94
src/components/article/CollectionSummary.astro
Normal file
@ -0,0 +1,94 @@
|
||||
---
|
||||
import type { CollectionEntry } from "astro:content";
|
||||
import { getCollection, type CollectionKey } from "astro:content";
|
||||
import CategorySummary from "./CategorySummary.astro";
|
||||
|
||||
interface Props {
|
||||
collectionName: CollectionKey;
|
||||
sortedByTimeline: boolean;
|
||||
}
|
||||
const { collectionName, sortedByTimeline } = Astro.props;
|
||||
|
||||
type CategoriedPosts = {
|
||||
[categoryName: string]: Array<CollectionEntry<CollectionKey>>;
|
||||
};
|
||||
|
||||
const allPosts: CollectionEntry<CollectionKey>[] =
|
||||
await getCollection(collectionName);
|
||||
|
||||
const allCategories: Array<string> = Array.from(
|
||||
new Set(
|
||||
allPosts.map((entry) => {
|
||||
return entry.data.category;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
const categoriedPostList: Array<CategoriedPosts> = allCategories.map((key) => {
|
||||
let object: CategoriedPosts = {};
|
||||
object[key] = allPosts.filter((post) => post.data.category === key);
|
||||
sortedByTimeline
|
||||
? object[key].sort(
|
||||
(
|
||||
postA: CollectionEntry<CollectionKey>,
|
||||
postB: CollectionEntry<CollectionKey>
|
||||
) => {
|
||||
if (postA.data.lastUpdate !== postB.data.lastUpdate) {
|
||||
return postA.data.lastUpdate < postB.data.lastUpdate ? 1 : -1;
|
||||
}
|
||||
return postA.id.localeCompare(postB.id);
|
||||
}
|
||||
)
|
||||
: object[key].sort(
|
||||
(
|
||||
postA: CollectionEntry<CollectionKey>,
|
||||
postB: CollectionEntry<CollectionKey>
|
||||
) => {
|
||||
return postA.id.localeCompare(postB.id);
|
||||
}
|
||||
);
|
||||
return object;
|
||||
});
|
||||
|
||||
const categoriedPostListSortedByArticleAmount: Array<CategoriedPosts> =
|
||||
JSON.parse(JSON.stringify(categoriedPostList)).sort(
|
||||
(a: CategoriedPosts, b: CategoriedPosts) => {
|
||||
const aKey: string = Object.keys(a)[0];
|
||||
const bKey: string = Object.keys(b)[0];
|
||||
return b[bKey].length - a[aKey].length;
|
||||
}
|
||||
);
|
||||
---
|
||||
|
||||
<div class="collection-desc">
|
||||
{
|
||||
categoriedPostListSortedByArticleAmount.map((obj) => (
|
||||
<div class="collection-desc-item">
|
||||
<CategorySummary
|
||||
collectionName={collectionName}
|
||||
categoryName={Object.keys(obj)[0]}
|
||||
posts={obj[Object.keys(obj)[0]]}
|
||||
/>
|
||||
</div>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
@media screen and (max-width: 125ex) {
|
||||
.collection-desc-item {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
@media screen and (min-width: 125ex) {
|
||||
.collection-desc-item {
|
||||
width: 50%;
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
.collection-desc::after {
|
||||
display: block;
|
||||
content: "";
|
||||
clear: both;
|
||||
}
|
||||
</style>
|
2
src/env.d.ts
vendored
Normal file
2
src/env.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/// <reference path="../.astro/types.d.ts" />
|
||||
/// <reference types="astro/client" />
|
19
src/layouts/DefaultLayout.astro
Normal file
19
src/layouts/DefaultLayout.astro
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
import HTMLCommonHead from "../components/HTMLCommonHead.astro";
|
||||
import "../styles/global.css"
|
||||
|
||||
interface Props {
|
||||
title: string;
|
||||
}
|
||||
const { title } = Astro.props;
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<HTMLCommonHead title={title}/>
|
||||
</head>
|
||||
<body>
|
||||
<slot />
|
||||
</body>
|
||||
</html>
|
12
src/pages/404.astro
Normal file
12
src/pages/404.astro
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
import DefaultLayout from "../layouts/DefaultLayout.astro";
|
||||
import Nav from "../components/Nav.astro";
|
||||
import Footer from "../components/Footer.astro";
|
||||
import ArticleBody from "../components/article/ArticleBody.astro";
|
||||
---
|
||||
|
||||
<DefaultLayout title="404">
|
||||
<Nav />
|
||||
<ArticleBody collectionName="site" articleSlug="404" />
|
||||
<Footer />
|
||||
</DefaultLayout>
|
34
src/pages/article/blog/[...blog].astro
Normal file
34
src/pages/article/blog/[...blog].astro
Normal file
@ -0,0 +1,34 @@
|
||||
---
|
||||
import { getCollection } from "astro:content";
|
||||
import type {
|
||||
CollectionEntry,
|
||||
CollectionKey,
|
||||
ContentEntryMap,
|
||||
} from "astro:content";
|
||||
import Footer from "../../../components/Footer.astro";
|
||||
import Nav from "../../../components/Nav.astro";
|
||||
import ArticleBody from "../../../components/article/ArticleBody.astro";
|
||||
import DefaultLayout from "../../../layouts/DefaultLayout.astro";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const collectionName: CollectionKey = "blog";
|
||||
const blogEntries = await getCollection(collectionName);
|
||||
return blogEntries.map((entry) => ({
|
||||
params: { blog: entry.slug },
|
||||
props: { entry },
|
||||
}));
|
||||
}
|
||||
|
||||
interface Props {
|
||||
entry: CollectionEntry<keyof ContentEntryMap>;
|
||||
}
|
||||
const { entry } = Astro.props;
|
||||
|
||||
const articlePrettyName:string = entry.id.split("/").pop()!.replace(".md", "");
|
||||
---
|
||||
|
||||
<DefaultLayout title=`${articlePrettyName} - 李守中`>
|
||||
<Nav />
|
||||
<ArticleBody collectionName="blog" articleSlug={entry.slug} />
|
||||
<Footer />
|
||||
</DefaultLayout>
|
21
src/pages/article/blog/index.astro
Normal file
21
src/pages/article/blog/index.astro
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
import Footer from '../../../components/Footer.astro';
|
||||
import Nav from '../../../components/Nav.astro';
|
||||
import CollectionSummary from '../../../components/article/CollectionSummary.astro';
|
||||
import DefaultLayout from '../../../layouts/DefaultLayout.astro';
|
||||
---
|
||||
|
||||
<DefaultLayout title="博客 - 李守中">
|
||||
<Nav />
|
||||
<div class="options">
|
||||
<span>当前: [按日期降序] <a href="/article/blog/sort_by_name">按名字排序</a></span>
|
||||
</div>
|
||||
<CollectionSummary collectionName="blog" sortedByTimeline={true}/>
|
||||
<Footer />
|
||||
</DefaultLayout>
|
||||
|
||||
<style>
|
||||
.options {
|
||||
margin: 1em 0 0 0;
|
||||
}
|
||||
</style>
|
21
src/pages/article/blog/sort_by_name.astro
Normal file
21
src/pages/article/blog/sort_by_name.astro
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
import Footer from '../../../components/Footer.astro';
|
||||
import Nav from '../../../components/Nav.astro';
|
||||
import CollectionSummary from '../../../components/article/CollectionSummary.astro';
|
||||
import DefaultLayout from '../../../layouts/DefaultLayout.astro';
|
||||
---
|
||||
|
||||
<DefaultLayout title="博客 - 李守中">
|
||||
<Nav />
|
||||
<div class="options">
|
||||
<span>当前: [按名字排序] <a href="/article/blog/">按日期降序</a></span>
|
||||
</div>
|
||||
<CollectionSummary collectionName="blog" sortedByTimeline={false}/>
|
||||
<Footer />
|
||||
</DefaultLayout>
|
||||
|
||||
<style>
|
||||
.options {
|
||||
margin: 1em 0 0 0;
|
||||
}
|
||||
</style>
|
34
src/pages/article/note/[...note].astro
Normal file
34
src/pages/article/note/[...note].astro
Normal file
@ -0,0 +1,34 @@
|
||||
---
|
||||
import { getCollection } from "astro:content";
|
||||
import type {
|
||||
CollectionEntry,
|
||||
CollectionKey,
|
||||
ContentEntryMap,
|
||||
} from "astro:content";
|
||||
import Footer from "../../../components/Footer.astro";
|
||||
import Nav from "../../../components/Nav.astro";
|
||||
import ArticleBody from "../../../components/article/ArticleBody.astro";
|
||||
import DefaultLayout from "../../../layouts/DefaultLayout.astro";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const collectionName: CollectionKey = "note";
|
||||
const blogEntries = await getCollection(collectionName);
|
||||
return blogEntries.map((entry) => ({
|
||||
params: { note: entry.slug },
|
||||
props: { entry },
|
||||
}));
|
||||
}
|
||||
|
||||
interface Props {
|
||||
entry: CollectionEntry<keyof ContentEntryMap>;
|
||||
}
|
||||
const { entry } = Astro.props;
|
||||
|
||||
const articlePrettyName:string = entry.id.split("/").pop()!.replace(".md", "");
|
||||
---
|
||||
|
||||
<DefaultLayout title=`${articlePrettyName} - 李守中`>
|
||||
<Nav />
|
||||
<ArticleBody collectionName="note" articleSlug={entry.slug} />
|
||||
<Footer />
|
||||
</DefaultLayout>
|
21
src/pages/article/note/index.astro
Normal file
21
src/pages/article/note/index.astro
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
import Footer from '../../../components/Footer.astro';
|
||||
import Nav from '../../../components/Nav.astro';
|
||||
import CollectionSummary from '../../../components/article/CollectionSummary.astro';
|
||||
import DefaultLayout from '../../../layouts/DefaultLayout.astro';
|
||||
---
|
||||
|
||||
<DefaultLayout title="笔记 - 李守中">
|
||||
<Nav />
|
||||
<div class="options">
|
||||
<span>当前: [按名字排序] <a href="/article/note/sort_by_timeline">按日期降序</a></span>
|
||||
</div>
|
||||
<CollectionSummary collectionName="note" sortedByTimeline={false}/>
|
||||
<Footer />
|
||||
</DefaultLayout>
|
||||
|
||||
<style>
|
||||
.options {
|
||||
margin: 1em 0 0 0;
|
||||
}
|
||||
</style>
|
21
src/pages/article/note/sort_by_timeline.astro
Normal file
21
src/pages/article/note/sort_by_timeline.astro
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
import Footer from '../../../components/Footer.astro';
|
||||
import Nav from '../../../components/Nav.astro';
|
||||
import CollectionSummary from '../../../components/article/CollectionSummary.astro';
|
||||
import DefaultLayout from '../../../layouts/DefaultLayout.astro';
|
||||
---
|
||||
|
||||
<DefaultLayout title="笔记 - 李守中">
|
||||
<Nav />
|
||||
<div class="options">
|
||||
<span>当前: [按日期降序] <a href="/article/note/">按名字排序</a></span>
|
||||
</div>
|
||||
<CollectionSummary collectionName="note" sortedByTimeline={true}/>
|
||||
<Footer />
|
||||
</DefaultLayout>
|
||||
|
||||
<style>
|
||||
.options {
|
||||
margin: 1em 0 0 0;
|
||||
}
|
||||
</style>
|
34
src/pages/article/translation/[...translation].astro
Normal file
34
src/pages/article/translation/[...translation].astro
Normal file
@ -0,0 +1,34 @@
|
||||
---
|
||||
import { getCollection } from "astro:content";
|
||||
import type {
|
||||
CollectionEntry,
|
||||
CollectionKey,
|
||||
ContentEntryMap,
|
||||
} from "astro:content";
|
||||
import Footer from "../../../components/Footer.astro";
|
||||
import Nav from "../../../components/Nav.astro";
|
||||
import ArticleBody from "../../../components/article/ArticleBody.astro";
|
||||
import DefaultLayout from "../../../layouts/DefaultLayout.astro";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const collectionName: CollectionKey = "translation";
|
||||
const blogEntries = await getCollection(collectionName);
|
||||
return blogEntries.map((entry) => ({
|
||||
params: { translation: entry.slug },
|
||||
props: { entry },
|
||||
}));
|
||||
}
|
||||
|
||||
interface Props {
|
||||
entry: CollectionEntry<keyof ContentEntryMap>;
|
||||
}
|
||||
const { entry } = Astro.props;
|
||||
|
||||
const articlePrettyName:string = entry.id.split("/").pop()!.replace(".md", "");
|
||||
---
|
||||
|
||||
<DefaultLayout title=`${articlePrettyName} - 李守中`>
|
||||
<Nav />
|
||||
<ArticleBody collectionName="translation" articleSlug={entry.slug} />
|
||||
<Footer />
|
||||
</DefaultLayout>
|
21
src/pages/article/translation/index.astro
Normal file
21
src/pages/article/translation/index.astro
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
import Footer from '../../../components/Footer.astro';
|
||||
import Nav from '../../../components/Nav.astro';
|
||||
import CollectionSummary from '../../../components/article/CollectionSummary.astro';
|
||||
import DefaultLayout from '../../../layouts/DefaultLayout.astro';
|
||||
---
|
||||
|
||||
<DefaultLayout title="翻译 - 李守中">
|
||||
<Nav />
|
||||
<div class="options">
|
||||
<span>当前: [按名字排序] <a href="/article/translation/sort_by_timeline">按日期降序</a></span>
|
||||
</div>
|
||||
<CollectionSummary collectionName="translation" sortedByTimeline={false}/>
|
||||
<Footer />
|
||||
</DefaultLayout>
|
||||
|
||||
<style>
|
||||
.options {
|
||||
margin: 1em 0 0 0;
|
||||
}
|
||||
</style>
|
21
src/pages/article/translation/sort_by_timeline.astro
Normal file
21
src/pages/article/translation/sort_by_timeline.astro
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
import Footer from '../../../components/Footer.astro';
|
||||
import Nav from '../../../components/Nav.astro';
|
||||
import CollectionSummary from '../../../components/article/CollectionSummary.astro';
|
||||
import DefaultLayout from '../../../layouts/DefaultLayout.astro';
|
||||
---
|
||||
|
||||
<DefaultLayout title="翻译 - 李守中">
|
||||
<Nav />
|
||||
<div class="options">
|
||||
<span>当前: [按日期降序] <a href="/article/translation/">按名字排序</a></span>
|
||||
</div>
|
||||
<CollectionSummary collectionName="translation" sortedByTimeline={true}/>
|
||||
<Footer />
|
||||
</DefaultLayout>
|
||||
|
||||
<style>
|
||||
.options {
|
||||
margin: 1em 0 0 0;
|
||||
}
|
||||
</style>
|
12
src/pages/index.astro
Normal file
12
src/pages/index.astro
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
import DefaultLayout from "../layouts/DefaultLayout.astro";
|
||||
import Nav from "../components/Nav.astro";
|
||||
import Footer from "../components/Footer.astro";
|
||||
import ArticleBody from "../components/article/ArticleBody.astro";
|
||||
---
|
||||
|
||||
<DefaultLayout title="李守中">
|
||||
<Nav />
|
||||
<ArticleBody collectionName="site" articleSlug="关于本站" />
|
||||
<Footer />
|
||||
</DefaultLayout>
|
99
src/styles/global.css
Normal file
99
src/styles/global.css
Normal file
@ -0,0 +1,99 @@
|
||||
@media screen and (max-width: 125ex) {
|
||||
body {
|
||||
width: 95%;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 125ex) {
|
||||
body {
|
||||
width: 125ex;
|
||||
}
|
||||
}
|
||||
|
||||
html {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-family: "Consolas", "Hack", -apple-system,
|
||||
BlinkMacSystemFont, Tahoma, Arial, "Hiragino Sans GB", "Microsoft YaHei",
|
||||
"WenQuanYi Micro Hei", sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
|
||||
"Segoe UI Symbol", "Noto Color Emoji";
|
||||
font-size: 1em;
|
||||
margin: auto;
|
||||
overflow-y: scroll;
|
||||
min-height: 100%;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #275d93;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
hr {
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background: #ccc;
|
||||
color: #ccc;
|
||||
margin: 1em 0;
|
||||
border: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* table start */
|
||||
table {
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table tr th,
|
||||
table tr td {
|
||||
border-right: 1px solid #ccc;
|
||||
border-bottom: 1px solid #ccc;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
table tr th:first-child,
|
||||
table tr td:first-child {
|
||||
border-left: 1px solid #ccc;
|
||||
}
|
||||
|
||||
table tr th:first-child,
|
||||
table tr td:first-child {
|
||||
border-left: 1px solid #ccc;
|
||||
}
|
||||
|
||||
table tr th {
|
||||
background: #eee;
|
||||
border-top: solid 1px #ccc;
|
||||
}
|
||||
|
||||
/* top-left border-radius */
|
||||
table tr:first-child th:first-child {
|
||||
border-top-left-radius: 6px;
|
||||
}
|
||||
|
||||
/* top-right border-radius */
|
||||
table tr:first-child th:last-child {
|
||||
border-top-right-radius: 6px;
|
||||
}
|
||||
|
||||
/* bottom-left border-radius */
|
||||
table tr:last-child td:first-child {
|
||||
border-bottom-left-radius: 6px;
|
||||
}
|
||||
|
||||
/* bottom-right border-radius */
|
||||
table tr:last-child td:last-child {
|
||||
border-bottom-right-radius: 6px;
|
||||
}
|
||||
|
||||
/* table end */
|
3
tsconfig.json
Normal file
3
tsconfig.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "astro/tsconfigs/strict"
|
||||
}
|
Loading…
Reference in New Issue
Block a user