fixes to refs

This commit is contained in:
hamdy
2020-11-08 22:27:35 +02:00
parent 6aa843cfe4
commit 0321ce6f7f
5 changed files with 53 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
--- ---
id: christine id: christine
name: Christine name: Christine
category: team
bio: Primis vitae mauris turpis ornare libero odio torquent vehicula proin consequat curabitur mattis bio: Primis vitae mauris turpis ornare libero odio torquent vehicula proin consequat curabitur mattis
facebook: https://www.facebook.com facebook: https://www.facebook.com
twitter: https://www.twitter.com twitter: https://www.twitter.com

View File

@@ -1,6 +1,7 @@
--- ---
id: kristof id: kristof
name: kds name: kds
category: team
bio: Primis vitae mauris turpis ornare libero odio torquent vehicula proin consequat curabitur mattis bio: Primis vitae mauris turpis ornare libero odio torquent vehicula proin consequat curabitur mattis
facebook: https://www.facebook.com facebook: https://www.facebook.com
twitter: https://www.twitter.com twitter: https://www.twitter.com

View File

@@ -34,7 +34,13 @@ module.exports = {
use: '@gridsome/source-filesystem', use: '@gridsome/source-filesystem',
options: { options: {
typeName: 'Author', typeName: 'Author',
path: './content/author/*.md' path: './content/author/*.md',
refs: {
category: {
typeName: 'Category',
create: true
}
}
} }
}, },
{ {

View File

@@ -10,6 +10,14 @@
</div> </div>
<div class="w-full md:w-5/6 text-center md:text-left md:pl-8 lg:pl-0"> <div class="w-full md:w-5/6 text-center md:text-left md:pl-8 lg:pl-0">
<h1 class="pb-0 mb-0 mt-0 text-4xl font-medium">{{ $page.author.name }}</h1> <h1 class="pb-0 mb-0 mt-0 text-4xl font-medium">{{ $page.author.name }}</h1>
<section class="post-header container mx-auto px-0 mb-4 border-b">
<span class="text-blue-500 font-medium uppercase tracking-wide text-sm">
<g-link
:to="$page.author.category.path"
class="hover:underline"
>{{ $page.author.category.title }}</g-link>
</span>
</section>
<p class="text-gray-700 text-xl" v-if="$page.author.bio">{{ $page.author.bio }}</p> <p class="text-gray-700 text-xl" v-if="$page.author.bio">{{ $page.author.bio }}</p>
<div class="author-social"> <div class="author-social">
{{ $page.author.belongsTo.totalCount }} Projects {{ $page.author.belongsTo.totalCount }} Projects
@@ -77,6 +85,22 @@
query($id: ID!, $page:Int) { query($id: ID!, $page:Int) {
author(id: $id) { author(id: $id) {
name name
category {
id
title
path
belongsTo(limit:4) {
totalCount
edges {
node {
... on Blog {
title
path
}
}
}
}
}
path path
bio bio
image(width:150, height:150) image(width:150, height:150)
@@ -103,6 +127,7 @@
category { category {
id id
title title
path
} }
author { author {
id id

View File

@@ -70,6 +70,25 @@
} }
} }
} }
node {
... on Author {
name
path
bio
bio
image(width:150, height:150)
facebook
twitter
linkedin
content
category {
id
title
}
}
}
} }
} }
} }