Add filter
This commit is contained in:
@@ -61,13 +61,13 @@ module.exports = function(api) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
api.createPages(async({
|
api.createPages(async({
|
||||||
graphql,
|
graphql,
|
||||||
createPage
|
createPage
|
||||||
}) => {
|
}) => {
|
||||||
// Use the Pages API here: https://gridsome.org/docs/pages-api
|
// Use the Pages API here: https://gridsome.org/docs/pages-api
|
||||||
const {
|
const {
|
||||||
data
|
data
|
||||||
} = await graphql(`{
|
} = await graphql(`{
|
||||||
allNews {
|
allNews {
|
||||||
edges {
|
edges {
|
||||||
previous {
|
previous {
|
||||||
@@ -85,25 +85,25 @@ module.exports = function(api) {
|
|||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
|
|
||||||
data.allNews.edges.forEach(function(element) {
|
data.allNews.edges.forEach(function(element) {
|
||||||
createPage({
|
createPage({
|
||||||
path: element.node.path,
|
path: element.node.path,
|
||||||
component: './src/templates/NewsPost.vue',
|
component: './src/templates/NewsPost.vue',
|
||||||
context: {
|
context: {
|
||||||
previousElement: (element.previous) ? element.previous.id : '##empty##',
|
previousElement: (element.previous) ? element.previous.id : '##empty##',
|
||||||
nextElement: (element.next) ? element.next.id : '##empty##',
|
nextElement: (element.next) ? element.next.id : '##empty##',
|
||||||
id: element.node.id
|
id: element.node.id
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
api.createPages(async ({ graphql, createPage }) => {
|
api.createPages(async({ graphql, createPage }) => {
|
||||||
const { data } = await graphql(`{
|
const { data } = await graphql(`{
|
||||||
allProjectTag(filter: { title: {in: ["farming"]}}) {
|
allProjectTag(filter: { title: {in: ["tech", "foundation"]}}) {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
path
|
path
|
||||||
@@ -112,20 +112,20 @@ module.exports = function(api) {
|
|||||||
}
|
}
|
||||||
}`)
|
}`)
|
||||||
|
|
||||||
data.allProjectTag.edges.forEach(({ node }) => {
|
data.allProjectTag.edges.forEach(({ node }) => {
|
||||||
createPage({
|
createPage({
|
||||||
path: `${node.path}`,
|
path: `${node.path}`,
|
||||||
component: './src/templates/Tag.vue',
|
component: './src/templates/Tag.vue',
|
||||||
context: {
|
context: {
|
||||||
id: node.id,
|
id: node.id,
|
||||||
private: private
|
private: private
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
|
||||||
api.createPages(async ({ graphql, createPage }) => {
|
api.createPages(async({ graphql, createPage }) => {
|
||||||
const { data } = await graphql(`{
|
const { data } = await graphql(`{
|
||||||
allBlogTag {
|
allBlogTag {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
@@ -136,20 +136,20 @@ module.exports = function(api) {
|
|||||||
}
|
}
|
||||||
}`)
|
}`)
|
||||||
|
|
||||||
data.allBlogTag.edges.forEach(({ node }) => {
|
data.allBlogTag.edges.forEach(({ node }) => {
|
||||||
createPage({
|
createPage({
|
||||||
path: `${node.path}`,
|
path: `${node.path}`,
|
||||||
component: './src/templates/Tag.vue',
|
component: './src/templates/Tag.vue',
|
||||||
context: {
|
context: {
|
||||||
id: node.id,
|
id: node.id,
|
||||||
private: private
|
private: private
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
|
||||||
api.createPages(async ({ graphql, createPage }) => {
|
api.createPages(async({ graphql, createPage }) => {
|
||||||
const { data } = await graphql(`{
|
const { data } = await graphql(`{
|
||||||
allNewsTag {
|
allNewsTag {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
@@ -160,47 +160,47 @@ module.exports = function(api) {
|
|||||||
}
|
}
|
||||||
}`)
|
}`)
|
||||||
|
|
||||||
data.allNewsTag.edges.forEach(({ node }) => {
|
data.allNewsTag.edges.forEach(({ node }) => {
|
||||||
createPage({
|
createPage({
|
||||||
path: `${node.path}`,
|
path: `${node.path}`,
|
||||||
component: './src/templates/Tag.vue',
|
component: './src/templates/Tag.vue',
|
||||||
context: {
|
context: {
|
||||||
id: node.id,
|
id: node.id,
|
||||||
private: private
|
private: private
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
|
||||||
api.createPages(({ createPage }) => {
|
api.createPages(({ createPage }) => {
|
||||||
createPage({
|
createPage({
|
||||||
path: '/partners',
|
path: '/partners',
|
||||||
component: './src/templates/Partners.vue',
|
component: './src/templates/Partners.vue',
|
||||||
context: {
|
context: {
|
||||||
private: private
|
private: private
|
||||||
}
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
|
||||||
api.createPages(({ createPage }) => {
|
api.createPages(({ createPage }) => {
|
||||||
createPage({
|
createPage({
|
||||||
path: '/team',
|
path: '/team',
|
||||||
component: './src/templates/Team.vue',
|
component: './src/templates/Team.vue',
|
||||||
context: {
|
context: {
|
||||||
private: private
|
private: private
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
api.createPages(({ createPage }) => {
|
||||||
|
createPage({
|
||||||
|
path: '/search',
|
||||||
|
component: './src/templates/Search.vue',
|
||||||
|
context: {
|
||||||
|
private: private
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
api.createPages(({ createPage }) => {
|
|
||||||
createPage({
|
|
||||||
path: '/search',
|
|
||||||
component: './src/templates/Search.vue',
|
|
||||||
context: {
|
|
||||||
private: private
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
<page-query>
|
<page-query>
|
||||||
|
|
||||||
query($page: Int){
|
query($page: Int){
|
||||||
entries: allBlog(perPage: 10, page: $page, sortBy: "created", order: DESC, filter: {category: { id: {in: ["farming"]}}}) @paginate{
|
entries: allBlog(perPage: 10, page: $page, sortBy: "created", order: DESC, filter: {category: { id: {in: ["tech", "foundation"]}}}) @paginate{
|
||||||
totalCount
|
totalCount
|
||||||
pageInfo {
|
pageInfo {
|
||||||
totalPages
|
totalPages
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
<page-query>
|
<page-query>
|
||||||
query($page: Int){
|
query($page: Int){
|
||||||
entries: allNews(perPage: 10, page: $page, sortBy: "created", order: DESC, filter: {category: { id: {in: ["farming"]}}}) @paginate{
|
entries: allNews(perPage: 10, page: $page, sortBy: "created", order: DESC, filter: {category: { id: {in: ["tech", "foundation"]}}}) @paginate{
|
||||||
totalCount
|
totalCount
|
||||||
pageInfo {
|
pageInfo {
|
||||||
totalPages
|
totalPages
|
||||||
@@ -67,7 +67,7 @@ query($page: Int){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
topics: allNewsTag{
|
topics: allNewsTag {
|
||||||
edges{
|
edges{
|
||||||
node{
|
node{
|
||||||
title
|
title
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<page-query>
|
<page-query>
|
||||||
query ($private: Int){
|
query ($private: Int){
|
||||||
entries: allProject (sortBy: "rank", order: DESC, filter: { private: { ne: $private }, tags: { id: {in: ["farming"]}}}){
|
entries: allProject (sortBy: "rank", order: DESC, filter: { private: { ne: $private }, tags: { id: {in: ["tech", "foundation"]}}}){
|
||||||
totalCount
|
totalCount
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
@@ -39,7 +39,7 @@ query ($private: Int){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tags: allProjectTag (filter: { title: {in: ["farming"]}}) {
|
tags: allProjectTag (filter: { title: {in: ["tech", "foundation"]}}) {
|
||||||
edges{
|
edges{
|
||||||
node{
|
node{
|
||||||
id
|
id
|
||||||
@@ -70,5 +70,8 @@ export default {
|
|||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted(){
|
||||||
|
console.log(this.$page)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -136,7 +136,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tags: allProjectTag (filter: { title: {in: ["farming"]}}) {
|
tags: allProjectTag (filter: { title: {in: ["tech", "foundation"]}}) {
|
||||||
edges{
|
edges{
|
||||||
node{
|
node{
|
||||||
id
|
id
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<page-query>
|
<page-query>
|
||||||
|
|
||||||
query ($private: Int){
|
query ($private: Int){
|
||||||
entries: allProject (sortBy: "rank", order: DESC, filter: { private: { ne: $private }}){
|
entries: allProject (sortBy: "rank", order: DESC, filter: { private: { ne: $private }}, tags: { id: {in: ["tech", "foundation"]}}){
|
||||||
totalCount
|
totalCount
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<page-query>
|
<page-query>
|
||||||
|
|
||||||
query ($private: Int){
|
query ($private: Int){
|
||||||
projects: allProject (filter: { private: { ne: $private }, tags: { id: {in: ["farming"]}}}){
|
projects: allProject (filter: { private: { ne: $private }, tags: { id: {in: ["tech", "foundation"]}}}){
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
|
|||||||
@@ -130,7 +130,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allProjectTag(filter: { title: {in: ["farming"]}}){
|
allProjectTag(filter: { title: {in: ["tech", "foundation"]}}){
|
||||||
edges{
|
edges{
|
||||||
node{
|
node{
|
||||||
id
|
id
|
||||||
|
|||||||
Reference in New Issue
Block a user