Skip to content

Commit

Permalink
Posts: fixup.
Browse files Browse the repository at this point in the history
  • Loading branch information
shandianchengzi committed Apr 5, 2024
1 parent 43762bb commit 2bc16e2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
4 changes: 4 additions & 0 deletions pages/src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const blog = defineCollection({
proofread_date: z.union(
[z.date(), z.string(), z.number()]
).default(""),
publisher: z.string().default(SITE.author),
published_date: z.union(
[z.date(), z.string(), z.number()]
).default(""),
}),
});

Expand Down
46 changes: 24 additions & 22 deletions pages/src/layouts/PostDetails.astro
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface Props {
const { post } = Astro.props;
const { title, author, collected_date, collector, translated_date, translator, link, proofreader, proofread_date } = post.data;
const { title, author, collected_date, collector, translated_date, translator, link, proofreader, proofread_date, publisher, published_date } = post.data;
const { Content } = await post.render();
Expand Down Expand Up @@ -62,30 +62,32 @@ const layoutProps = {
<Content />
<hr>
<div>
<!-- if there is translated_date, show below -->
{
translated_date && (
<p><strong>译自:</strong> <a href="{link}">{link}</a></p>
<p>
<p><strong>{!translated_date ? "原文链接:": "译自:"}</strong> <a href={link}>{link}</a></p>
<p>
<strong>选题:</strong>
<a href={"https://github/" + collector}>{collector}</a>
{translated_date && (
<span>
&nbsp;&nbsp;
<strong>译者:</strong>
<a href={"https://github/" + translator}>{translator}</a>
{
proofread_date && (
{proofread_date && (
<span>
&nbsp;&nbsp;
<strong>校对:</strong><a href={"https://github/" + proofreader}>{proofreader}</a>
<p>本文由<a href="https://gitee.com/hust-open-atom-club/translate-project">HCTT</a>原创翻译,<a href="https://gitee.com/hust-open-atom-club">华科开放原子俱乐部</a>荣誉推出。</p>
)
}
</p>
)
}
<!-- if there is not translated_date, show below -->
{
!translated_date && (
<p><strong>原文链接:</strong> <a href="{link}">{link}</a></p>
)
}

</div>
</span>
)}
{published_date && (
<span>
&nbsp;&nbsp;
<strong>发布:</strong><a href={"https://github/" + publisher}>{publisher}</a>
</span>
)}
</span>
)}
</p>
<p>本文{!translated_date && ""}由 <a href="https://gitee.com/hust-open-atom-club/translate-project">HCTT 翻译团队</a> 原创翻译,<a href="https://gitee.com/hust-open-atom-club">华中科技大学开放原子开源俱乐部</a>荣誉推出。</p>
</div>
</article>

<!-- <ul class="my-8"> -->
Expand Down

0 comments on commit 2bc16e2

Please sign in to comment.