diff --git a/src/.vuepress/plugins/pageData.js b/src/.vuepress/plugins/pageData.js index 79d5e59f..927786fe 100644 --- a/src/.vuepress/plugins/pageData.js +++ b/src/.vuepress/plugins/pageData.js @@ -32,18 +32,40 @@ module.exports = (options, context) => ({ extendPageData($page) { const { frontmatter } = $page - // author config - const authorName = frontmatter.author + if (frontmatter.type) { + frontmatter.type = { + name: frontmatter.type, + slug: slug(frontmatter.type), + } + } - if (typeof authorName === 'string') { - const authorKey = slug(authorName, { lower: true }) + if (typeof frontmatter.author === 'string') { + frontmatter.author = frontmatter.author + .split(/,|and|&/) + .map((author) => ({ name: author.trim(), slug: slug(author) })) + } - // setup author stub to keep templates happy - const author = { name: authorName } + if (frontmatter.tags) { + frontmatter.tags = frontmatter.tags.map((tag) => ({ + name: tag, + slug: slug(tag), + })) + } - // setup the page author object - frontmatter.author = author - frontmatter.authorKey = authorKey + if (frontmatter.data) { + frontmatter.data.forEach((subPage) => { + if (subPage.tags) { + subPage.tags = subPage.tags.map((tag) => ({ + name: tag, + slug: slug(tag), + })) + } + + // set links has hidden (future publishes, etc) + if (shouldBeHidden(subPage)) { + subPage.hidden = true + } + }) } // exclude hidden pages (sitemap config, future publishes, etc) @@ -62,14 +84,5 @@ module.exports = (options, context) => ({ frontmatter.hidden = true $page.hidden = true } - - // set links has hidden (future publishes, etc) - if (frontmatter.data) { - frontmatter.data.forEach((item) => { - if (shouldBeHidden(item)) { - item.hidden = true - } - }) - } }, }) diff --git a/src/.vuepress/theme/components/blog/ActiveTags.vue b/src/.vuepress/theme/components/blog/ActiveTags.vue index 534ba897..19e0031a 100644 --- a/src/.vuepress/theme/components/blog/ActiveTags.vue +++ b/src/.vuepress/theme/components/blog/ActiveTags.vue @@ -22,7 +22,7 @@ (newest first) of {{ resolvedActiveCategory }} - by {{ activeAuthor }} + by {{ activeAuthor.name }} for {{ resolvedSearchedText }} @@ -37,7 +37,7 @@ class="multiselect__tag active-tag text-sm" @click="tagClick(tag)" > - #{{ tag }}#{{ tagsList.find((t) => t.slug === tag).name }} @@ -75,13 +75,16 @@ export default { }, computed: { ...mapState('appState', [ + 'tagsList', 'activeCategory', 'activeTags', 'searchedText', 'activeAuthor', ]), resolvedActiveCategory() { - return this.activeCategory ? `type "${this.activeCategory}"` : 'all types' + return this.activeCategory + ? `type "${this.activeCategory.name}"` + : 'all types' }, resolvedSearchedText() { return `"${this.searchedText.join(' ')}"` diff --git a/src/.vuepress/theme/components/blog/Card.vue b/src/.vuepress/theme/components/blog/Card.vue index 06a1e0e5..649d019b 100644 --- a/src/.vuepress/theme/components/blog/Card.vue +++ b/src/.vuepress/theme/components/blog/Card.vue @@ -33,7 +33,7 @@ export default { return RegularCard } - switch (this.card.type) { + switch (this.card.type.name) { case 'Academic paper': case 'Event': case 'News coverage': diff --git a/src/.vuepress/theme/components/blog/LinkCard.vue b/src/.vuepress/theme/components/blog/LinkCard.vue index 2ffbdc04..ec75fc63 100644 --- a/src/.vuepress/theme/components/blog/LinkCard.vue +++ b/src/.vuepress/theme/components/blog/LinkCard.vue @@ -15,7 +15,7 @@ See here: https://github.com/ipfs/ipfs-blog/pull/94 -->
@@ -47,10 +47,7 @@ :src=" frontmatter.card_image ? frontmatter.card_image - : `/${frontmatter.type - .toLowerCase() - .split(' ') - .join('-')}-placeholder.png` + : `/${frontmatter.type.slug}-placeholder.png` " />
@@ -64,7 +61,9 @@ :title="title" :description="frontmatter.description" :post-path="path" - :onclick="frontmatter.type === 'Video' ? handleVideoClick : null" + :onclick=" + frontmatter.type.slug === 'video' ? handleVideoClick : null + " class="type-p4 text-primary" /> diff --git a/src/.vuepress/theme/components/blog/PostAuthor.vue b/src/.vuepress/theme/components/blog/PostAuthor.vue index baad517e..e473ccfd 100644 --- a/src/.vuepress/theme/components/blog/PostAuthor.vue +++ b/src/.vuepress/theme/components/blog/PostAuthor.vue @@ -1,8 +1,8 @@