Skip to content

Commit

Permalink
content: update
Browse files Browse the repository at this point in the history
  • Loading branch information
andyluss committed Jul 8, 2024
1 parent 3d3949b commit f6981c6
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineCollection, z } from "astro:content";

const commonSchema = z.object({
title: z.string(),
tags: z.string().array().optional(),
tags: z.string().array().default([]),
level: z.number().default(0),
description: z.string().optional(),
// Transform string to Date object
Expand Down
2 changes: 1 addition & 1 deletion src/content/xyy/20240608.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 环境的影响
pubDate: 2024-06-08
tags: [🏞️环境]
tags: [🏡家园]
---

环境对人的影响是巨大的,所谓靠山吃山,靠水吃水,近朱者赤,近墨者黑。
Expand Down
2 changes: 1 addition & 1 deletion src/content/xyy/20240609a.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 安全自在的小环境
pubDate: 2024-06-09
tags: [💖人生, 🏞️环境]
tags: [💖人生, 🏡家园]
---

约法三章:
Expand Down
2 changes: 1 addition & 1 deletion src/content/xyy/20240615.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 应对自然环境与人类自身的不确定性
pubDate: 2024-06-15
tags: [🌳自然]
tags: [🌳自然, 🏡家园]
---

就像这个文章《[大自然的力量有多恐怖?]》里展示的那样,人类在大自然面前还是不值一提,所谓的高科技在大自然看来也只是比普通动物进步了一丢丢。
Expand Down
2 changes: 1 addition & 1 deletion src/content/xyy/20240617.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 土地空间环境平等的重要性
pubDate: 2024-06-17
tags: [🏞️环境, 👫社会]
tags: [🏡家园, 👯‍♀️社会]
---

对普通人来说,土地空间环境是最容易平等划分而不至于引起大纠纷的财产。其它财产比如消费品、企业股份、知识产权等,都不容易保值,波动比较大,不适合普通人。所以,土地空间环境作为主食,其它财产作为辅食,更容易保持社会稳定。
Expand Down
2 changes: 1 addition & 1 deletion src/content/xyy/20240706d.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 生产者与掠夺者
pubDate: 2024-07-06
tags: [🌳自然, 社会]
tags: [🌳自然, 👯‍♀️社会]
---

这个世界的生命,以及衍生出来的社会,都是以能量或者负熵为基础的。我们没法获取超过自然提供的所得。
Expand Down
38 changes: 26 additions & 12 deletions src/layouts/IndexLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ const posts = (await getCollection(category)).sort(
(a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf(),
);
const highLevelPosts = (await getCollection(category)).filter(
(post) => post.data.level >= 3,
);
const tags = [
...posts.reduce(
(accTags, post) => new Set([...accTags, ...post.data.tags]),
new Set(),
),
];
---

<!doctype html>
Expand All @@ -29,14 +32,14 @@ const highLevelPosts = (await getCollection(category)).filter(
main {
width: 1250px;
}
ul {
.posts ul {
display: flex;
flex-wrap: wrap;
list-style-type: none;
margin: 0;
padding: 0;
}
ul li {
.posts ul li {
width: 240px;
height: 80px;
border-style: solid;
Expand All @@ -45,15 +48,15 @@ const highLevelPosts = (await getCollection(category)).filter(
margin: 1px;
box-sizing: border-box;
}
ul li * {
.posts ul li * {
text-decoration: none;
transition: 0.2s ease;
}
ul li img {
.posts ul li img {
margin-bottom: 0.5rem;
border-radius: 12px;
}
ul li a {
.posts ul li a {
display: block;
}
.title {
Expand All @@ -74,14 +77,14 @@ const highLevelPosts = (await getCollection(category)).filter(
color: rgb(var(--gray));
font-size: x-small;
}
ul li a:hover .title {
.posts ul li a:hover .title {
color: rgb(var(--accent));
}
ul a:hover img {
.posts ul a:hover img {
box-shadow: var(--box-shadow);
}
@media (max-width: 720px) {
ul li {
.posts ul li {
width: 100%;
height: auto;
text-align: center;
Expand All @@ -92,7 +95,18 @@ const highLevelPosts = (await getCollection(category)).filter(
<body>
<Header />
<main>
<section>
<section class="tags">
<ul class="list-none p-0 m-0 flex flex-wrap text-sm">
{
tags.map((tag) => (
<li class="mr-1 mb-1 bg-gray-200 border-2 rounded">
{tag}
</li>
))
}
</ul>
</section>
<section class="posts">
<ul>
{
posts.reverse().map((post, index) => (
Expand Down

0 comments on commit f6981c6

Please sign in to comment.