fix tags
This commit is contained in:
@@ -176,7 +176,7 @@ module.exports = {
|
|||||||
}],
|
}],
|
||||||
|
|
||||||
ProjectTag: [{
|
ProjectTag: [{
|
||||||
path: '/projects/tags/:id',
|
path: '/tags/:id',
|
||||||
component: '~/templates/Tag.vue'
|
component: '~/templates/Tag.vue'
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,8 @@ module.exports = function(api) {
|
|||||||
private: private
|
private: private
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
});
|
||||||
|
|
||||||
|
|
||||||
api.createPages(async({
|
api.createPages(async({
|
||||||
graphql,
|
graphql,
|
||||||
@@ -178,4 +179,37 @@ module.exports = function(api) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
api.createPages(async({
|
||||||
|
graphql,
|
||||||
|
createPage
|
||||||
|
}) => {
|
||||||
|
// Use the Pages API here: https://gridsome.org/docs/pages-api
|
||||||
|
const {
|
||||||
|
data
|
||||||
|
} = await graphql(`{
|
||||||
|
allProjectTag {
|
||||||
|
edges {
|
||||||
|
|
||||||
|
node {
|
||||||
|
id
|
||||||
|
path
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
|
||||||
|
data.allProjectTag.edges.forEach(function(element) {
|
||||||
|
createPage({
|
||||||
|
path: element.node.path,
|
||||||
|
component: './src/templates/Tag.vue',
|
||||||
|
context: {
|
||||||
|
id: element.node.id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
@@ -2,12 +2,12 @@
|
|||||||
<Layout :hideHeader="true" :disableScroll="true">
|
<Layout :hideHeader="true" :disableScroll="true">
|
||||||
<div class="container sm:pxi-0 mx-auto overflow-x-hidden pt-24">
|
<div class="container sm:pxi-0 mx-auto overflow-x-hidden pt-24">
|
||||||
<div class="mx-4 sm:mx-0">
|
<div class="mx-4 sm:mx-0">
|
||||||
<h1 class="pb-0 mb-0 text-5xl font-medium">{{ $page.tag.title }}</h1>
|
<h1 class="pb-0 mb-0 text-5xl font-medium">{{ $page.projectTag.title }}</h1>
|
||||||
<p class="text-gray-700 text-xl">
|
<p class="text-gray-700 text-xl">
|
||||||
A
|
A
|
||||||
<span
|
<span
|
||||||
class="self-center"
|
class="self-center"
|
||||||
>{{ $page.tag.belongsTo.totalCount }} Projects</span>
|
>{{ $page.projectTag.belongsTo.totalCount }} Projects</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
<div class="flex flex-wrap pt-8 pb-8 mx-4 sm:-mx-4">
|
<div class="flex flex-wrap pt-8 pb-8 mx-4 sm:-mx-4">
|
||||||
<PostListItem
|
<PostListItem
|
||||||
v-for="edge in $page.tag.belongsTo.edges"
|
v-for="edge in $page.projectTag.belongsTo.edges"
|
||||||
:key="edge.node.id"
|
:key="edge.node.id"
|
||||||
:record="edge.node"
|
:record="edge.node"
|
||||||
/>
|
/>
|
||||||
@@ -23,11 +23,11 @@
|
|||||||
|
|
||||||
<div class="pagination flex justify-center mb-8">
|
<div class="pagination flex justify-center mb-8">
|
||||||
<Pagination
|
<Pagination
|
||||||
:baseUrl="$page.tag.path"
|
:baseUrl="$page.projectTag.path"
|
||||||
:currentPage="$page.tag.belongsTo.pageInfo.currentPage"
|
:currentPage="$page.projectTag.belongsTo.pageInfo.currentPage"
|
||||||
:totalPages="$page.tag.belongsTo.pageInfo.totalPages"
|
:totalPages="$page.projectTag.belongsTo.pageInfo.totalPages"
|
||||||
:maxVisibleButtons="5"
|
:maxVisibleButtons="5"
|
||||||
v-if="$page.tag.belongsTo.pageInfo.totalPages > 1"
|
v-if="$page.projectTag.belongsTo.pageInfo.totalPages > 1"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -35,11 +35,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<page-query>
|
<page-query>
|
||||||
query($id: ID!, $page:Int) {
|
query($id: ID!) {
|
||||||
tag(id: $id) {
|
projectTag(id: $id) {
|
||||||
title
|
title
|
||||||
path
|
path
|
||||||
belongsTo(perPage: 10, page: $page) @paginate {
|
belongsTo{
|
||||||
totalCount
|
totalCount
|
||||||
pageInfo {
|
pageInfo {
|
||||||
totalPages
|
totalPages
|
||||||
@@ -90,7 +90,7 @@ export default {
|
|||||||
|
|
||||||
metaInfo() {
|
metaInfo() {
|
||||||
return {
|
return {
|
||||||
title: this.$page.tag.title
|
title: ""
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user