Bladeren bron

:recycle: tweaking theme to display blog for posts

tags/0.9.0
J 4 jaren geleden
bovenliggende
commit
325a9bd8ba

+ 5
- 1
vue-theme/src/components/breadcrumb.vue Bestand weergeven

3
 nav.breadcrumb.f-row.start.t-up
3
 nav.breadcrumb.f-row.start.t-up
4
     router-link(v-if="['event','exhibition'].includes(type)" :to="`/${type}/sorted/by-current-and-upcoming`")
4
     router-link(v-if="['event','exhibition'].includes(type)" :to="`/${type}/sorted/by-current-and-upcoming`")
5
         h5.t-up {{ type }}
5
         h5.t-up {{ type }}
6
+    router-link(v-else-if="type == 'post'" :to="`/blog`")
7
+        h5.t-up blog
6
     router-link(v-else :to="`/${type}`")
8
     router-link(v-else :to="`/${type}`")
7
         h5.t-up {{ type }}
9
         h5.t-up {{ type }}
8
     h5  ➤ 
10
     h5  ➤ 
9
-    router-link(:to="`/${type}/${post.slug}`")
11
+    router-link(v-if="type == 'post'" :to="`/blog/${post.slug}`")
12
+        h5 {{ post.title }}
13
+    router-link(v-else :to="`/${type}/${post.slug}`")
10
         h5 {{ post.title }}
14
         h5 {{ post.title }}
11
 </template>
15
 </template>
12
 
16
 

+ 11
- 3
vue-theme/src/components/card.vue Bestand weergeven

3
     header
3
     header
4
         router-link(v-if="!hideType && ['event','exhibition'].includes(type)" :to="`/${type}/sorted/by-current-and-upcoming`")
4
         router-link(v-if="!hideType && ['event','exhibition'].includes(type)" :to="`/${type}/sorted/by-current-and-upcoming`")
5
             h4.t-up {{type}}
5
             h4.t-up {{type}}
6
+        router-link(v-else-if="type == 'post'" :to="`/blog`")
7
+            h4.t-up blog
6
         router-link(v-else-if="!hideType" :to="`/${type}`")
8
         router-link(v-else-if="!hideType" :to="`/${type}`")
7
             h4.t-up {{type}}
9
             h4.t-up {{type}}
8
 
10
 
9
     article.card--info(:class="{ 'wide': wide }")
11
     article.card--info(:class="{ 'wide': wide }")
10
-        router-link(:to="`/${type}/${content.slug}`")
12
+        router-link(v-if="type == 'post'" :to="`/blog/${content.slug}`")
13
+            featured-image(:post="content", thumbsize="'standard'")
14
+        router-link(v-else :to="`/${type}/${content.slug}`")
11
             //- set image to thumbnail setting
15
             //- set image to thumbnail setting
12
             featured-image(:post="content", thumbsize="'standard'")
16
             featured-image(:post="content", thumbsize="'standard'")
13
         .f-col.w-max(style="height: inherit")
17
         .f-col.w-max(style="height: inherit")
14
-            router-link(:to="`/${type}/${content.slug}`")
18
+            router-link(v-if="type == 'post'" :to="`/blog/${content.slug}`")
19
+                h1.t-up.t-cntr.t-b {{ content.title }}
20
+            router-link(v-else :to="`/${type}/${content.slug}`")
15
                 h1.t-up.t-cntr.t-b {{ content.title }}
21
                 h1.t-up.t-cntr.t-b {{ content.title }}
16
             p(v-if="content.end && type == 'event'" class="datetime") {{ dateFrom(content.start, type=='event') }} &ndash; {{ dateFrom(content.end, type=='event').split(',')[1] }}
22
             p(v-if="content.end && type == 'event'" class="datetime") {{ dateFrom(content.start, type=='event') }} &ndash; {{ dateFrom(content.end, type=='event').split(',')[1] }}
17
             p(v-else-if="content.end" class="datetime") {{ dateFrom(content.start, type=='event') }} &ndash; {{ dateFrom(content.end, type=='event') }}
23
             p(v-else-if="content.end" class="datetime") {{ dateFrom(content.start, type=='event') }} &ndash; {{ dateFrom(content.end, type=='event') }}
18
             p.excerpt {{ content.excerpt }}
24
             p.excerpt {{ content.excerpt }}
19
-            router-link(:to="`/${type}/${content.slug}`")
25
+            router-link(v-if="type == 'post'" :to="`/blog/${content.slug}`")
26
+                p.read-more read more
27
+            router-link(v-else :to="`/${type}/${content.slug}`")
20
                 p.read-more read more
28
                 p.read-more read more
21
 </template>
29
 </template>
22
 
30
 

+ 8
- 6
vue-theme/src/pages/single.vue Bestand weergeven

74
          * Careful with name collisions with vuex helpers
74
          * Careful with name collisions with vuex helpers
75
          */
75
          */
76
         singlePost() {
76
         singlePost() {
77
-            if (!this[this.type]) return
77
+            const postType = this.type == 'blog' ? 'post': this.type
78
+            if (!this[postType]) return
78
 
79
 
79
             // State not a getter!
80
             // State not a getter!
80
             const singleOfTypeFromState =
81
             const singleOfTypeFromState =
81
-                this[this.type][`single${convertTitleCase(this.type)}`]
82
+                this[postType][`single${convertTitleCase(postType)}`]
82
 
83
 
83
             if (!singleOfTypeFromState) return
84
             if (!singleOfTypeFromState) return
84
 
85
 
181
              * which is derived from the route
182
              * which is derived from the route
182
              */
183
              */
183
             // modules are NOT plural because module key
184
             // modules are NOT plural because module key
184
-            if (!this.$store.state[this.type]) return
185
-            const allPostsOfTypeInStore = this.$store.state[this.type].all
185
+            const postType = this.type == 'blog' ? 'post': this.type
186
+            if (!this.$store.state[postType]) return
187
+            const allPostsOfTypeInStore = this.$store.state[postType].all
186
 
188
 
187
             /**
189
             /**
188
              * Load posts if they're not already in state
190
              * Load posts if they're not already in state
197
             if (!singlePostData) {
199
             if (!singlePostData) {
198
                 console.warn('Could not find single post in store; Fetching everything...')
200
                 console.warn('Could not find single post in store; Fetching everything...')
199
                 const res = await this.$store.dispatch(
201
                 const res = await this.$store.dispatch(
200
-                    `getAll${convertTitleCase(this.type)}s`,
202
+                    `getAll${convertTitleCase(postType)}s`,
201
                     { sortType: null, params: null }
203
                     { sortType: null, params: null }
202
                 )
204
                 )
203
                 singlePostData = res.filter(
205
                 singlePostData = res.filter(
211
             try {
213
             try {
212
                 this.checkAndSetHero(singlePostData)
214
                 this.checkAndSetHero(singlePostData)
213
                 await this.$store.dispatch(
215
                 await this.$store.dispatch(
214
-                    `getSingle${convertTitleCase(this.type)}`,
216
+                    `getSingle${convertTitleCase(postType)}`,
215
                     singlePostData.id,
217
                     singlePostData.id,
216
                 )
218
                 )
217
             } catch (err) {
219
             } catch (err) {

+ 1
- 0
vue-theme/src/store/index.js Bestand weergeven

87
     mutations,
87
     mutations,
88
     state,
88
     state,
89
     modules: {
89
     modules: {
90
+        'blog': post,
90
         post,
91
         post,
91
         page,
92
         page,
92
         artist,
93
         artist,

Laden…
Annuleren
Opslaan