diff --git a/blog/2021-10-18-archived.md b/blog/2021-10-18-archived.md index f4e5d14..c61cbfe 100644 --- a/blog/2021-10-18-archived.md +++ b/blog/2021-10-18-archived.md @@ -7,6 +7,7 @@ tags: ['archived'] categories: ['archived'] thumbnail: ./archived.png is_archived: true +sidebar: Alternative --- ## How to Archive Post diff --git a/gridsome.server.js b/gridsome.server.js index 389f3e9..750a9a0 100644 --- a/gridsome.server.js +++ b/gridsome.server.js @@ -36,4 +36,19 @@ module.exports = function (api) { api.createPages(({ createPage }) => { // Use the Pages API here: https://gridsome.org/docs/pages-api/ }) + + api.loadSource(({ addSchemaResolvers }) => { + // Schema API here: https://gridsome.org/docs/schema-api/ + // Create a default value for "sidebar" to prevent Cannot query errors if not used + addSchemaResolvers({ + Post: { + sidebar: { + type: 'String', + resolve(obj) { + return (obj.sidebar === undefined ? 'Default' : obj.sidebar) + } + } + } + }) + }) } diff --git a/src/components/parts/AppSidebar.vue b/src/components/parts/AppSidebar.vue index 6a5a243..85ae2a3 100644 --- a/src/components/parts/AppSidebar.vue +++ b/src/components/parts/AppSidebar.vue @@ -1,10 +1,19 @@ + + \ No newline at end of file diff --git a/src/components/sidebars/Alternative.vue b/src/components/sidebars/Alternative.vue new file mode 100644 index 0000000..a4a502e --- /dev/null +++ b/src/components/sidebars/Alternative.vue @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/src/components/sidebars/Categories.vue b/src/components/sidebars/Categories.vue new file mode 100644 index 0000000..b90588a --- /dev/null +++ b/src/components/sidebars/Categories.vue @@ -0,0 +1,29 @@ + + + +query { + category: allCategory(sortBy: "title", order: ASC) { + edges { + node { + id + title + path + belongsTo { + totalCount + } + } + } + } +} + \ No newline at end of file diff --git a/src/components/sidebars/Default.vue b/src/components/sidebars/Default.vue new file mode 100644 index 0000000..336d78c --- /dev/null +++ b/src/components/sidebars/Default.vue @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index e981a98..2c9b242 100644 --- a/src/main.js +++ b/src/main.js @@ -29,4 +29,17 @@ export default function (Vue, { router, head, isClient }) { perPage: process.env.VSSUE_GRIDSOME_PERPAGE || 15, autoCreateIssue: process.env.GRIDSOME_VSSUE_OWNER || false, }) + + // Add vue filter to capitalise the first letter of each word + Vue.filter('capitalise', function (value) { + let output = [] + value.split(' ').forEach(word => { + output.push( + word.charAt(0).toUpperCase() + + word.slice(1).toLowerCase() + ) + }) + return output.join(' ') + } + ) } diff --git a/src/pages/Blog.vue b/src/pages/Blog.vue index 7ff57ec..af7e0d7 100644 --- a/src/pages/Blog.vue +++ b/src/pages/Blog.vue @@ -31,7 +31,7 @@ dark:border-gray-700 " > - + diff --git a/src/templates/Category.vue b/src/templates/Category.vue index 19cbdf0..3beb6f6 100644 --- a/src/templates/Category.vue +++ b/src/templates/Category.vue @@ -34,7 +34,7 @@ dark:border-gray-700 " > - + diff --git a/src/templates/Post.vue b/src/templates/Post.vue index 09e8f23..89058d6 100644 --- a/src/templates/Post.vue +++ b/src/templates/Post.vue @@ -134,7 +134,7 @@ " aria-label="right-sidebar" > - + @@ -146,6 +146,7 @@ query Post ($path: String!) { title summary is_archived + sidebar thumbnail path date (format: "MMMM D, Y")