Change GhostPage template to a symlink
Because that's what it is. No point updating the same content twice in different files :P The reason is, Gridsome needs GhostPage to exist so the page gets a valid path, but doesn't actually use it because it loads GhostPost first. We could technically leave GhostPage as an empty file, but if the order changes someday and GhostPage starts getting prioritised over GhostPost we'll be in a mess. Might as well keep ourselves covered.
This commit is contained in:
parent
b602cea6a5
commit
30f9448d72
1 changed files with 1 additions and 165 deletions
|
@ -1,165 +0,0 @@
|
|||
<template>
|
||||
<Layout>
|
||||
<header class="site-header outer">
|
||||
<div class="inner">
|
||||
<Navbar :logo="true"/>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- <FloatingHeader/> -->
|
||||
|
||||
<main id="site-main" class="site-main outer">
|
||||
<div class="inner">
|
||||
<article :class="postClass">
|
||||
<header class="post-full-header">
|
||||
<section class="post-full-meta" v-if="thisPost.tags">
|
||||
<time class="post-full-meta-date" :datetime="thisPost.date | moment('d, MMMM YYYY')">{{ thisPost.date | moment("d, MMMM YYYY") }}</time>
|
||||
<span class="date-divider">/</span>
|
||||
<a
|
||||
:href="thisPost.tags[0].path"
|
||||
>{{ thisPost.tags[0].title.replace('-', ' ') }}</a>
|
||||
</section>
|
||||
<h1 class="post-full-title">{{ thisPost.title }}</h1>
|
||||
</header>
|
||||
|
||||
<figure v-if="thisPost.image" class="post-full-image">
|
||||
<g-image :src="thisPost.image|changeUrls" :alt="thisPost.title"/>
|
||||
</figure>
|
||||
|
||||
<section class="post-full-content">
|
||||
<div class="post-content" v-html="fullPost"></div>
|
||||
</section>
|
||||
|
||||
<!-- Email subscribe form at the bottom of the page -->
|
||||
<section v-if="Admin.site.subscribers" class="subscribe-form">
|
||||
<h3 class="subscribe-form-title">Subscribe to {{ Admin.site.title }}</h3>
|
||||
<p>Get the latest posts delivered right to your inbox</p>
|
||||
<subscribeForm placeholder="youremail@example.com"/>
|
||||
</section>
|
||||
|
||||
<bylineMultiple :author="thisPost.authors" v-if="thisPost.authors && thisPost.authors.length > 1"/>
|
||||
<bylineSingle :author="thisPost.authors" v-if="thisPost.authors && thisPost.authors.length == 1" />
|
||||
|
||||
<!-- NOTE Comment section -->
|
||||
<!-- <section class="post-full-comments">
|
||||
If you want to embed comments, this is a good place to do it!
|
||||
</section>-->
|
||||
</article>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<PreviousNext :id="thisPost.id" :tag="thisPost.tags[0]" :posts="thisPost.tags[0].belongsTo.edges" v-if="thisPost.tags"/>
|
||||
</Layout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Admin from "../../data/admin.yml";
|
||||
import Navbar from "../components/Navbar";
|
||||
import FloatingHeader from "../components/FloatingHeader";
|
||||
import subscribeForm from "../components/subscribeForm";
|
||||
import bylineMultiple from "../components/bylineMultiple";
|
||||
import bylineSingle from "../components/bylineSingle";
|
||||
import PreviousNext from "../components/PreviousNext";
|
||||
import changeUrls from '../filters/changeUrls';
|
||||
|
||||
export default {
|
||||
metaInfo() {
|
||||
let bodyAttrs;
|
||||
if (this.$page.post) {
|
||||
bodyAttrs = `post-template tag-${this.$page.post.tags[0].title}`
|
||||
} else {
|
||||
bodyAttrs = "page-template"
|
||||
}
|
||||
return {
|
||||
title: this.$page.post ? this.$page.post.title : this.$page.page.title,
|
||||
bodyAttrs: {
|
||||
class: bodyAttrs
|
||||
}
|
||||
};
|
||||
},
|
||||
components: {
|
||||
Navbar,
|
||||
FloatingHeader,
|
||||
subscribeForm,
|
||||
bylineMultiple,
|
||||
bylineSingle,
|
||||
PreviousNext
|
||||
},
|
||||
filters: {
|
||||
changeUrls: changeUrls
|
||||
},
|
||||
computed: {
|
||||
Admin() {
|
||||
return Admin;
|
||||
},
|
||||
fullPost() {
|
||||
let thisPost = this.$page.post || this.$page.page
|
||||
return changeUrls(thisPost.content);
|
||||
},
|
||||
postClass() {
|
||||
let classes = []
|
||||
if (this.$page.post) {
|
||||
classes.push("post-full");
|
||||
classes.push("post");
|
||||
if (!this.$page.post.image) {
|
||||
classes.push("no-image");
|
||||
}
|
||||
const postTagClass = "tag-" + this.$page.post.tags[0].title;
|
||||
classes.push(postTagClass);
|
||||
} else {
|
||||
classes.push("page-full");
|
||||
classes.push("page");
|
||||
}
|
||||
return classes;
|
||||
},
|
||||
thisPost() {
|
||||
// Return post or page, whichever exists
|
||||
return this.$page.page || this.$page.post
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<page-query>
|
||||
query Post ($path: String!) {
|
||||
post: ghostPost (path: $path) {
|
||||
id
|
||||
title
|
||||
path
|
||||
date: published_at (format: "D. MMMM YYYY")
|
||||
tags {
|
||||
id
|
||||
slug
|
||||
path
|
||||
title: name
|
||||
belongsTo {
|
||||
edges {
|
||||
node {
|
||||
... on GhostPost {
|
||||
id
|
||||
title
|
||||
path
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
authors {
|
||||
name
|
||||
id
|
||||
slug
|
||||
image: profile_image
|
||||
}
|
||||
description: excerpt
|
||||
content: html
|
||||
image: feature_image
|
||||
}
|
||||
page: ghostPage (path: $path) {
|
||||
id
|
||||
title
|
||||
path
|
||||
date: updated_at (format: "D. MMMM YYYY")
|
||||
description: excerpt
|
||||
content: html
|
||||
}
|
||||
}
|
||||
</page-query>
|
1
src/templates/GhostPage.vue
Symbolic link
1
src/templates/GhostPage.vue
Symbolic link
|
@ -0,0 +1 @@
|
|||
./GhostPost.vue
|
Loading…
Reference in a new issue