dynamic filteration based on env variables
This commit is contained in:
@@ -17,19 +17,19 @@ module.exports = {
|
||||
{
|
||||
typeName: 'Blog',
|
||||
indexName: 'Blog',
|
||||
fields: ['id', 'name', 'title', 'rank', 'excerpt', 'image', 'path', 'datetime', 'author', 'pageInfo']
|
||||
fields: ['path']
|
||||
},
|
||||
|
||||
{
|
||||
typeName: 'Project',
|
||||
indexName: 'Project',
|
||||
fields: ['id', 'title', 'rank', 'excerpt', 'image', 'path', 'datetime', 'author', 'pageInfo']
|
||||
fields: ['path']
|
||||
},
|
||||
|
||||
{
|
||||
typeName: 'Person',
|
||||
indexName: 'Person',
|
||||
fields: ['id', 'name', 'rank', 'excerpt', 'image', 'path', 'bio', 'pageInfo']
|
||||
fields: ['path']
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
@@ -5,6 +5,12 @@
|
||||
// Changes here require a server restart.
|
||||
// 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) {
|
||||
api.loadSource(({
|
||||
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 ({
|
||||
graphql,
|
||||
createPage
|
||||
|
||||
@@ -34,6 +34,7 @@ query{
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
excerpt
|
||||
image(width:800)
|
||||
path
|
||||
humanTime : created(format:"DD MMM YYYY")
|
||||
|
||||
@@ -119,6 +119,7 @@
|
||||
image(width:1600, height:800)
|
||||
image_caption
|
||||
content
|
||||
excerpt
|
||||
humanTime : created(format:"DD MMMM YYYY")
|
||||
datetime : created(format:"ddd MMM DD YYYY hh:mm:ss zZ")
|
||||
timeToRead
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
|
||||
<page-query>
|
||||
|
||||
query {
|
||||
entries: allPerson (sortBy: "rank", order: DESC){
|
||||
query ($private: Int){
|
||||
entries: allPerson (sortBy: "rank", order: DESC, filter: { private: { ne: $private }}){
|
||||
totalCount
|
||||
edges {
|
||||
node {
|
||||
path
|
||||
excerpt
|
||||
content
|
||||
content
|
||||
name
|
||||
rank
|
||||
memberships{
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
<page-query>
|
||||
|
||||
query {
|
||||
entries: allProject (sortBy: "rank", order: DESC){
|
||||
query ($private: Int){
|
||||
entries: allProject (sortBy: "rank", order: DESC, filter: { private: { ne: $private }}){
|
||||
totalCount
|
||||
edges {
|
||||
node {
|
||||
@@ -20,8 +20,8 @@
|
||||
</template>
|
||||
<page-query>
|
||||
|
||||
query {
|
||||
projects: allProject {
|
||||
query ($private: Int){
|
||||
projects: allProject (filter: { private: { ne: $private }}){
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
@@ -53,7 +53,7 @@ query {
|
||||
}
|
||||
}
|
||||
|
||||
people: allPerson {
|
||||
people: allPerson(filter: { private: { ne: $private }}) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
Reference in New Issue
Block a user