liferay.design icon indicating copy to clipboard operation
liferay.design copied to clipboard

Prevent Drafts or Inactive Teammate Pages from Being Built

Open plhnk opened this issue 5 years ago • 3 comments

Describe the bug Currently, the "draft" mode just hides the cards from the various pages — would be great if there was a true "draft" mode where the page is built in the dev environment, but not production.

plhnk avatar Jul 19 '19 14:07 plhnk

I don't really know if that is possible with the technology we are using.

victorvalle avatar Oct 22 '19 10:10 victorvalle

anything is possible @victorvalle :)

I started looking into this briefly, for anyone interested in picking up, here's where I think would be a good place to start:

in gatsby-node.js the createPages function at line 19:

exports.createPages = ({ actions, graphql }) => {
	const { createPage } = actions

	return new Promise((resolve, reject) => {
		resolve(
			graphql(`
				query {
					allMdx {
						edges {
							node {
								id
								fields {
									slug
								}
								frontmatter {
									tags
								}
								code {
									scope
								}
							}
						}
					}
				}
			`)

I think it may be possible to filter the frontmatter for "draft" and "inactive" — but that is only half the equation. Need to think more about how to conditionally do it so they build during gatsby develop' but not gatsby build`.

plhnk avatar Oct 22 '19 14:10 plhnk

whats difficult about this is we still want posts from inactive teammates built — it's easy to say "if teammate is inactive, don't publish anything associated w/them" — what's harder is "if teammate is inactive, don't publish their profile"

plhnk avatar Jul 29 '20 05:07 plhnk