This repository was archived by the owner on Dec 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.vue
85 lines (73 loc) · 1.76 KB
/
index.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<template>
<div class="">
<div class="devto">
<h2>👨💻 Dev.to Articles</h2>
<p class="subtext">Web development and ramblings about programming</p>
<p></p>
<div
v-for="(article, index) in devToArticles"
:key="index"
class="article"
>
<a :href="article.url">{{ article.title }} </a>
<p class="timestamp">
Posted on: {{ new Date(article.published_at).toDateString() }}
</p>
</div>
</div>
<div class="blogs">
<h2>📝 Blogs</h2>
<p class="subtext">Musings about life, wellbeing and fitness</p>
<div v-for="(blog, index) in blogs" :key="index" class="article">
<NuxtLink :to="`${blog.slug}`"> {{ blog.title }}</NuxtLink>
<p class="timestamp">
Posted on: {{ new Date(blog.date).toDateString() }}
</p>
</div>
</div>
<div class="archive">
<NuxtLink to="archive" tag="h1">🗄️ Archive</NuxtLink>
<p>Writings from my old blog. Awkward.</p>
</div>
</div>
</template>
<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
async asyncData({ $axios, $content }) {
const devToArticles: DevTo.Article[] = await $axios.$get(
'https://dev.to/api/articles/me/published?page=1&per_page=1000',
{
headers: { 'api-key': process.env.DEVTO_KEY },
}
)
const blogs = await $content('/').fetch()
return { devToArticles, blogs }
},
})
</script>
<style scoped>
.devto {
padding-top: 25px;
}
.blogs {
padding-top: 25px;
}
.article {
padding-top: 10px;
}
.timestamp {
font-size: 0.8em;
color: grey;
}
.subtext {
font-style: italic;
}
.archive {
padding-top: 10px;
}
.archive:hover {
text-decoration: underline;
cursor: pointer;
}
</style>