File tree 4 files changed +44
-6
lines changed
4 files changed +44
-6
lines changed Original file line number Diff line number Diff line change 2
2
<div class =" w-full font-normal font-[Inter_Variable] prose-neutral dark:prose-invert" >
3
3
<div >
4
4
<navbar />
5
- <div class =" mx-a lt-md:px-4 md:prose" :class =" [$style.dashed_link]" >
5
+ <div class =" mx-a lt-md:px-4 md:prose" :class =" [$style.dashed_link, $style.no_header_underline ]" >
6
6
<slot />
7
7
<div class =" h-8" />
8
8
<cd />
17
17
--at-apply : " underline-dashed hover:underline-solid"
18
18
}
19
19
}
20
+
21
+ .no_header_underline {
22
+ h1 , h2 , h3 , h4 , h5 , h6 {
23
+ a {
24
+ --at-apply : ' no-underline'
25
+ }
26
+ }
27
+ }
20
28
</style >
Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
+ import type { MarkdownNode , ParsedContent } from ' @nuxt/content'
3
+
4
+ function parseNode(node : MarkdownNode ): number {
5
+ let wordCount = 0
6
+
7
+ if (node .type === ' text' && node .value ) {
8
+ wordCount += node .value .split (' ' ).length
9
+ }
10
+
11
+ for (const child of node .children ?? []) {
12
+ wordCount += parseNode (child )
13
+ }
14
+
15
+ return wordCount
16
+ }
17
+
18
+ function getWordCount(parsedContent : ParsedContent ): number {
19
+ let wordCount = 0
20
+
21
+ if (parsedContent .body ) {
22
+ for (const child of parsedContent .body .children ) {
23
+ wordCount += parseNode (child )
24
+ }
25
+ }
26
+
27
+ return wordCount
28
+ }
29
+
2
30
const ContentNotFound = defineComponent ({
3
31
setup() {
4
32
showError ({
@@ -14,8 +42,9 @@ const ContentNotFound = defineComponent({
14
42
<template #default =" { doc } " >
15
43
<div class =" pb-4" >
16
44
<h1 >{{ doc.title }}</h1 >
17
- <p class =" op-70" >
18
- {{ useDateFormat(doc.date, 'ddd, DD MMM YYYY') }}
45
+ <p class =" op-70 divide-x *:px-2 first:*:pl-0" >
46
+ <span >{{ useDateFormat(doc.date, 'ddd, DD MMMM YYYY') }}</span >
47
+ <span >{{ getWordCount(doc) }} words</span >
19
48
</p >
20
49
</div >
21
50
<content-renderer :value =" doc" />
Original file line number Diff line number Diff line change @@ -13,14 +13,14 @@ useHead({ title: 'Blogs' })
13
13
v-for =" blog in list .sort ((a , b ) => + new Date (b .date ) - + new Date (a .date ))"
14
14
:key =" blog ._path "
15
15
>
16
- <div class =" flex flex-col items-start py-3 md:(grid-cols-[75%,auto] flex-row pt-2) " >
16
+ <div class =" flex flex-col items-start py-2 md:flex-row" >
17
17
<h3 class =" my-2 flex-auto md:m-a" >
18
18
<nuxt-link :to =" blog._path" >
19
19
{{ blog.title }}
20
20
</nuxt-link >
21
21
</h3 >
22
- <p class =" my-0 op-70 md:m-a " >
23
- {{ useDateFormat(blog.date, 'DD MMM YYYY') }}
22
+ <p class =" my-0 op-70 md:(my-a ml-12 min-w-fit) " >
23
+ {{ useDateFormat(blog.date, 'DD MMMM YYYY') }}
24
24
</p >
25
25
</div >
26
26
</template >
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ export default defineNuxtConfig({
65
65
} ,
66
66
manifest : {
67
67
background_color : '#FFF' ,
68
+ theme_color : '#000' ,
68
69
display : 'minimal-ui' ,
69
70
lang : 'en' ,
70
71
orientation : 'portrait-primary' ,
You can’t perform that action at this time.
0 commit comments