From 16bcaaf54b76323edc0d20af1b86e4e9056747e3 Mon Sep 17 00:00:00 2001 From: Hippo Date: Thu, 19 Dec 2019 22:01:35 +0530 Subject: [PATCH] Enable image redirects Images can now go directly to media.snipettemag.com instead of being routed through the private Ghost instance. (Reduces traffic on that node). --- gridsome.config.js | 3 +++ src/components/Card.vue | 10 ++++++---- src/components/bylineMultiple.vue | 8 ++++++-- src/components/bylineSingle.vue | 6 +++++- src/filters/changeUrls.js | 10 ++++++++++ src/templates/GhostAuthor.vue | 8 +++++++- src/templates/GhostPost.vue | 11 +++++++++-- src/templates/GhostTag.vue | 4 ++++ 8 files changed, 50 insertions(+), 10 deletions(-) create mode 100644 src/filters/changeUrls.js diff --git a/gridsome.config.js b/gridsome.config.js index 3035999..8c3a6f7 100644 --- a/gridsome.config.js +++ b/gridsome.config.js @@ -4,6 +4,9 @@ module.exports = { siteDescription: 'The professional publishing platform', titleTemplate: `%s - Gridsome`, + mediaUrlFrom: 'https://snipette-ghost.herokuapp.com/content/images/', + mediaUrlTo: 'https://media.snipettemag.com/', + templates: { GhostPost: '/:slug', GhostTag: '/tag/:slug', diff --git a/src/components/Card.vue b/src/components/Card.vue index 125549b..863f2cd 100644 --- a/src/components/Card.vue +++ b/src/components/Card.vue @@ -2,7 +2,7 @@
-
+
@@ -14,7 +14,7 @@

{{ cardData.title }}

-

{{ cardData.description | stripHTML | truncate(190, '...') }}

+

{{ cardData.description | stripHTML | changeUrls | truncate(190, '...') }}