dynamic filteration based on env variables
This commit is contained in:
@@ -17,19 +17,19 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
typeName: 'Blog',
|
typeName: 'Blog',
|
||||||
indexName: 'Blog',
|
indexName: 'Blog',
|
||||||
fields: ['id', 'name', 'title', 'rank', 'excerpt', 'image', 'path', 'datetime', 'author', 'pageInfo']
|
fields: ['path']
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
typeName: 'Project',
|
typeName: 'Project',
|
||||||
indexName: 'Project',
|
indexName: 'Project',
|
||||||
fields: ['id', 'title', 'rank', 'excerpt', 'image', 'path', 'datetime', 'author', 'pageInfo']
|
fields: ['path']
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
typeName: 'Person',
|
typeName: 'Person',
|
||||||
indexName: 'Person',
|
indexName: 'Person',
|
||||||
fields: ['id', 'name', 'rank', 'excerpt', 'image', 'path', 'bio', 'pageInfo']
|
fields: ['path']
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,12 @@
|
|||||||
// Changes here require a server restart.
|
// Changes here require a server restart.
|
||||||
// To restart press CTRL + C in terminal and run `gridsome develop`
|
// To restart press CTRL + C in terminal and run `gridsome develop`
|
||||||
|
|
||||||
|
var private = process.env.SHOWPRIVATE
|
||||||
|
if (private == "true")
|
||||||
|
private = null
|
||||||
|
else if(private == "false")
|
||||||
|
private = 1
|
||||||
|
|
||||||
module.exports = function (api) {
|
module.exports = function (api) {
|
||||||
api.loadSource(({
|
api.loadSource(({
|
||||||
addCollection
|
addCollection
|
||||||
@@ -51,6 +57,36 @@ module.exports = function (api) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
api.createPages(({ createPage }) => {
|
||||||
|
createPage({
|
||||||
|
path: '/people',
|
||||||
|
component: './src/templates/People.vue',
|
||||||
|
context: {
|
||||||
|
private: private
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
api.createPages(({ createPage }) => {
|
||||||
|
createPage({
|
||||||
|
path: '/search',
|
||||||
|
component: './src/templates/Search.vue',
|
||||||
|
context: {
|
||||||
|
private: private
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
api.createPages(({ createPage }) => {
|
||||||
|
createPage({
|
||||||
|
path: '/projects',
|
||||||
|
component: './src/templates/Projects.vue',
|
||||||
|
context: {
|
||||||
|
private: private
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
api.createPages(async ({
|
api.createPages(async ({
|
||||||
graphql,
|
graphql,
|
||||||
createPage
|
createPage
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ query{
|
|||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
title
|
title
|
||||||
|
excerpt
|
||||||
image(width:800)
|
image(width:800)
|
||||||
path
|
path
|
||||||
humanTime : created(format:"DD MMM YYYY")
|
humanTime : created(format:"DD MMM YYYY")
|
||||||
|
|||||||
@@ -119,6 +119,7 @@
|
|||||||
image(width:1600, height:800)
|
image(width:1600, height:800)
|
||||||
image_caption
|
image_caption
|
||||||
content
|
content
|
||||||
|
excerpt
|
||||||
humanTime : created(format:"DD MMMM YYYY")
|
humanTime : created(format:"DD MMMM YYYY")
|
||||||
datetime : created(format:"ddd MMM DD YYYY hh:mm:ss zZ")
|
datetime : created(format:"ddd MMM DD YYYY hh:mm:ss zZ")
|
||||||
timeToRead
|
timeToRead
|
||||||
|
|||||||
@@ -10,14 +10,14 @@
|
|||||||
|
|
||||||
<page-query>
|
<page-query>
|
||||||
|
|
||||||
query {
|
query ($private: Int){
|
||||||
entries: allPerson (sortBy: "rank", order: DESC){
|
entries: allPerson (sortBy: "rank", order: DESC, filter: { private: { ne: $private }}){
|
||||||
totalCount
|
totalCount
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
path
|
path
|
||||||
excerpt
|
excerpt
|
||||||
content
|
content
|
||||||
name
|
name
|
||||||
rank
|
rank
|
||||||
memberships{
|
memberships{
|
||||||
@@ -10,8 +10,8 @@
|
|||||||
|
|
||||||
<page-query>
|
<page-query>
|
||||||
|
|
||||||
query {
|
query ($private: Int){
|
||||||
entries: allProject (sortBy: "rank", order: DESC){
|
entries: allProject (sortBy: "rank", order: DESC, filter: { private: { ne: $private }}){
|
||||||
totalCount
|
totalCount
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
@@ -20,8 +20,8 @@
|
|||||||
</template>
|
</template>
|
||||||
<page-query>
|
<page-query>
|
||||||
|
|
||||||
query {
|
query ($private: Int){
|
||||||
projects: allProject {
|
projects: allProject (filter: { private: { ne: $private }}){
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
@@ -53,7 +53,7 @@ query {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
people: allPerson {
|
people: allPerson(filter: { private: { ne: $private }}) {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
Reference in New Issue
Block a user