Skip to content

Commit 6d97cf0

Browse files
committed
Updates
1 parent 851a57f commit 6d97cf0

18 files changed

+165
-79
lines changed

assets/css/theme/page.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
@layer components {
44
.page-content {
5-
@apply relative;
5+
@apply relative py-12 lg:container mx-auto;
66
}
77

88
.page-content::before,

assets/css/theme/theme.css

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
@layer components {
44
/* wrapper */
5-
.wrapper {
6-
padding-top: -64px;
7-
}
5+
6+
/* .wrapper {
7+
padding-top: -64px;
8+
} */
89

910
/* img-fluid */
1011
.img-fluid {

components/cards/Article.vue

+11-2
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,17 @@
135135
<font-awesome-icon :icon="['fa', 'tags']" />
136136
</span>
137137
<span v-for="(tag, i) in item.tags" :key="i" class="capitalize">
138-
{{ tag
139-
}}{{
138+
<!-- <Nuxt-Link
139+
:to="
140+
localePath({
141+
name: 'article-tag',
142+
params: { slug: tag }
143+
})
144+
"
145+
> -->
146+
<Nuxt-Link :to="`/article/tag/${tag.replace(' ', '_')}`">
147+
{{ tag }}</Nuxt-Link
148+
>{{
140149
item.tags.length !== 1 && item.tags.length !== i + 1 ? ',' : ''
141150
}}
142151
</span>

components/cards/ArticleHeadline.vue

+26-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<section class="lg:container mx-auto my-12 pt-8 pb-4">
2+
<section class="lg:container mx-auto pb-4">
33
<!-- <h1 class="text-2xl">Headlines</h1> -->
44
<!-- <article v-if="items && items.length">
55
<div v-for="item in items" :key="item.slug" class="row">
@@ -62,14 +62,14 @@
6262
:key="item.slug"
6363
class="flex flex-wrap items-center sm:-mx-3 my-10"
6464
>
65-
<div class="w-full md:w-1/2 md:px-3">
65+
<div class="w-full md:w-1/2 md:px-3 md:pr-6">
6666
<div
6767
class="
6868
w-full
6969
pb-6
7070
space-y-6
7171
sm:max-w-md
72-
lg:max-w-lg
72+
lg:max-w-xl
7373
md:space-y-4
7474
lg:space-y-8
7575
xl:space-y-9
@@ -84,10 +84,10 @@
8484
font-extrabold
8585
tracking-tight
8686
text-gray-900
87-
sm:text-5xl
88-
md:text-4xl
89-
lg:text-5xl
90-
xl:text-6xl
87+
sm:text-4xl
88+
md:text-3xl
89+
lg:text-4xl
90+
xl:text-5xl
9191
"
9292
>
9393
<span class="block xl:inline">{{ item.title }}</span>
@@ -111,7 +111,18 @@
111111
<figcaption class="font-medium">
112112
<div class="text-gray-500 text-sm flex flex-initial">
113113
<span class="flex-1"
114-
>By: {{ item.author && item.author.name }}</span
114+
>By:
115+
<!-- <Nuxt-Link
116+
:to="
117+
localePath({
118+
name: 'article-author',
119+
params: { slug: item.author.name }
120+
})
121+
"
122+
> -->
123+
<Nuxt-Link :to="`/article/author/${item.author.name}`">
124+
{{ item.author.name }}</Nuxt-Link
125+
></span
115126
>
116127
<span class="flex-1 text-right">
117128
Posted:
@@ -131,8 +142,8 @@
131142
flex
132143
items-center
133144
w-full
134-
px-6
135-
py-3
145+
px-5
146+
py-2
136147
mb-3
137148
text-lg text-white
138149
bg-indigo-600
@@ -147,7 +158,7 @@
147158
Read More
148159
<svg
149160
xmlns="http://www.w3.org/2000/svg"
150-
class="w-5 h-5 ml-1"
161+
class="w-5 h-5 ml-"
151162
viewBox="0 0 24 24"
152163
fill="none"
153164
stroke="currentColor"
@@ -204,7 +215,10 @@
204215
})
205216
"
206217
>
207-
<img :src="item.img" class="w-full object-cover h-96" />
218+
<img
219+
:src="item.img"
220+
class="w-full object-cover h-60 md:h-72 xl:h-96"
221+
/>
208222
</Nuxt-Link>
209223
</div>
210224
</div>

config/i18n.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export default {
77
baseUrl: BASE_URL,
88
// strategy: 'prefix_and_default',
99
// strategy: 'no_prefix',
10-
strategy: 'prefix_except_default',
10+
// strategy: 'prefix_except_default',
11+
strategy: 'no_prefix',
1112
locales: [
1213
{
1314
code: 'en',
@@ -34,14 +35,21 @@ export default {
3435
// id: '/artikel',
3536
// en: '/blog'
3637
// },
37-
3838
'page-slug': {
3939
id: '/page/:slug?',
4040
en: '/page/:slug?'
4141
},
4242
'article-slug': {
4343
id: '/article/:slug?',
4444
en: '/article/:slug?'
45+
},
46+
'article-author': {
47+
id: '/article/author/:slug?',
48+
en: '/article/author/:slug?'
49+
},
50+
'article-tag': {
51+
id: '/article/tag/:slug',
52+
en: '/article/tag/:slug'
4553
}
4654
// 'dynamicNested/_category': {
4755
// fr: 'imbrication-dynamique/:category'

content/articles/lorem-ipsum-dolor-sit-amet-consecteteur.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ author:
1010
tags:
1111
- web development
1212
- vuejs
13+
headline: true
1314
createdAt: 20-May-2021 00:05
1415
updatedAt: 01-June-2021 20:30
1516
status: publish

content/articles/players-and-equipment.md

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ tags:
1212
- vuejs
1313
createdAt: 20-May-2021 00:05
1414
updatedAt: 01-June-2021 20:30
15-
headline: true
1615
status: publish
1716
---
1817

content/tags/vuejs.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
name: vuejs
3+
description: Vuejs is an open source framework making web development simple and powerful.
4+
img: https://images.unsplash.com/photo-1598313183973-4effcded8d5e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80
5+
---

nuxt.config.js

+15-6
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export default {
8585
generate: {
8686
routes: async () => {
8787
const routes = []
88+
const authors = []
8889
let pages = []
8990
let articles = []
9091
let tags = []
@@ -96,7 +97,7 @@ export default {
9697
pages = await $content('pages').where({ showInMenu: true }).fetch()
9798
}
9899

99-
/* Posts */
100+
/* Articles */
100101
if (articles === null || articles.length === 0) {
101102
articles = await $content('articles')
102103
.where({ status: 'publish' })
@@ -108,23 +109,31 @@ export default {
108109
routes.push(`/page/${page.slug}`)
109110
}
110111

111-
/* Posts */
112+
/* Articles */
112113
for (const article of articles) {
114+
authors.push(article.author.name)
113115
routes.push(`/article/${article.slug}`)
114116
}
115117

116-
/* Post Tags */
118+
/* Articles Authors */
119+
for (const author of authors.filter(function (item, index, inputArray) {
120+
return inputArray.indexOf(item) === index
121+
})) {
122+
routes.push(`/article/author/${author}`)
123+
}
124+
125+
/* Article Tags */
117126
if (tags === null || tags.length === 0) {
118127
tags = await $content('tags').fetch()
119128
}
120129

121-
/* Post Tags */
130+
/* Articles Tags */
122131
for (const tag of tags) {
123132
routes.push(`/article/tag/${tag.name.replace(' ', '_')}`)
124133
}
125134

126-
// return routes.sort()
127-
return routes
135+
return routes.sort()
136+
// return routes
128137
},
129138

130139
fallback: true // fallback to 404 page not found file

pages/404.vue

-14
This file was deleted.

pages/article/_slug.vue

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="page-content pt-24 min-h-screen h-full">
2+
<div class="page-content min-h-screen h-full">
33
<MetaHead
44
:title="article.title"
55
:description="article.description"
@@ -9,7 +9,21 @@
99
<div class="col-start-1 row-start-3 space-y-3 px-4">
1010
<h1 class="text-4xl font-black">{{ article.title }}</h1>
1111
<div class="my-4">
12-
<span>Author: {{ article.author.name }}</span> |
12+
<span
13+
>Author:
14+
<Nuxt-Link :to="`/article/author/${article.author.name}`">
15+
<!-- <Nuxt-Link
16+
:to="
17+
localePath({
18+
name: 'article-author',
19+
params: { slug: article.slug, author: article.author.name }
20+
})
21+
"
22+
> -->
23+
{{ article.author.name }}</Nuxt-Link
24+
></span
25+
>
26+
|
1327
<span>
1428
{{ $dateFns.format(article.createdAt, 'MMMM dd, yyyy') }}</span
1529
>
@@ -48,7 +62,7 @@ export default {
4862
const readAlso = await $content('articles')
4963
.only(['title', 'slug'])
5064
.where({
51-
offLink: false,
65+
status: 'publish',
5266
slug: { $ne: params.slug },
5367
tags: { $containsAny: Object.keys(tags) }
5468
})
@@ -57,7 +71,7 @@ export default {
5771
.fetch()
5872
5973
const [prev, next] = await $content('articles')
60-
.where({ offLink: false })
74+
.where({ status: 'publish' })
6175
.only(['title', 'slug'])
6276
.sortBy('createdAt', 'asc')
6377
.surround(params.slug)

pages/article/author/_slug.vue

+25-15
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
:image="articles[0].author.img"
1717
/>
1818
<div class="relative lg:w-1/2 xs:w-full xs:h-84 lg:h-full post-left">
19-
<amp-img
19+
<!-- <amp-img
2020
v-if="$isAMP"
2121
:src="articles[0].author.img"
2222
:alt="articles[0].author.name"
@@ -30,13 +30,19 @@
3030
:src="articles[0].author.img"
3131
:alt="articles[0].author.name"
3232
class="absolute h-full w-full object-cover"
33+
/> -->
34+
<img
35+
:src="articles[0].author.img"
36+
:alt="articles[0].author.name"
37+
class="absolute h-full w-full object-cover"
3338
/>
3439
</div>
3540

3641
<div class="overlay"></div>
3742
<div class="absolute top-32 left-32 text-white">
3843
<div class="relative">
39-
<NuxtLink to="/"><Logo :amp="$isAMP" /></NuxtLink>
44+
<!-- <NuxtLink to="/"><Logo :amp="$isAMP" /></NuxtLink> -->
45+
<NuxtLink to="/"><Logo /></NuxtLink>
4046
</div>
4147
<div class="mt-16 -mb-3 flex flex-col uppercase text-sm">
4248
<h1 class="text-4xl font-bold">
@@ -114,19 +120,23 @@
114120

115121
<script>
116122
export default {
117-
async asyncData({ $content, params }) {
118-
const articles = await $content('articles', params.slug)
119-
.where({
120-
'author.name': {
121-
$regex: [params.author, 'i']
122-
},
123-
offLink: false
124-
})
125-
.without('body')
126-
.sortBy('createdAt', 'asc')
127-
.fetch()
128-
return {
129-
articles
123+
async asyncData({ $content, params, error }) {
124+
try {
125+
const articles = await $content('articles')
126+
.where({
127+
'author.name': {
128+
$regex: [params.slug, 'i']
129+
},
130+
status: 'publish'
131+
})
132+
.without('body')
133+
.sortBy('createdAt', 'asc')
134+
.fetch()
135+
return {
136+
articles
137+
}
138+
} catch (err) {
139+
error(err)
130140
}
131141
}
132142
}

0 commit comments

Comments
 (0)