Skip to content

Commit

Permalink
feat(post): set title for post elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Octobug committed Dec 15, 2023
1 parent 92abc96 commit ceb0952
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
11 changes: 9 additions & 2 deletions .vitepress/theme/components/PostElements.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
:class="$style.elementList"
hidden
>
<span :class="$style.elementItem">
<span
:class="$style.elementItem"
:title="moment(post.datetime).format('dddd')"
>
{{ moment(post.datetime).format("LL") }}
</span>
<Dot
Expand All @@ -14,14 +17,18 @@
<span
v-if="post.location"
:class="$style.elementItem"
:title="post.community"
>
{{ post.location }}
</span>
<Dot
v-if="post.readingTime"
:class="$style.dot"
/>
<span :class="$style.elementItem">
<span
:class="$style.elementItem"
:title="`${post.words} words`"
>
{{ post.readingTime }}
</span>
</div>
Expand Down
4 changes: 3 additions & 1 deletion .vitepress/theme/posts.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ export default createContentLoader(extendedConfig.mdfilePatterns, {
includeSrc: true,
transform(rawData) {
return rawData.map(p => {
const rt = readingTime(p.src || "");
p.frontmatter.title = extractTile(p.src || "");
p.frontmatter.datetime = new Date(p.frontmatter.date);
p.frontmatter.readingTime = readingTime(p.src || "").text;
p.frontmatter.readingTime = rt.text;
p.frontmatter.words = rt.words;
p.url = withBaseURL(p.url.replace("/README", ""));
return p;
}).sort((a, b) => {
Expand Down
1 change: 1 addition & 0 deletions posts/an-https-issue-on-adas/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
date: 2019-12-18
location: 深圳 创维半导体设计大厦西座
community: 粤海街道高新区社区
sort: Computer Science
tags:
- Network
Expand Down
3 changes: 2 additions & 1 deletion posts/non-original-content-copyright-issues/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
date: 2023-12-14
location: 深圳 西乡街道财富港大厦
location: 深圳 财富港大厦
community: 西乡街道渔业社区
sort: Law
tags:
- Copyright
Expand Down
3 changes: 2 additions & 1 deletion posts/pilot/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
date: 2019-06-02
location: 深圳 西乡街道财富港大厦
location: 深圳 财富港大厦
community: 西乡街道渔业社区
sort: Miscellaneous
tags:
- Small Talk
Expand Down

0 comments on commit ceb0952

Please sign in to comment.