Skip to content

Commit

Permalink
feat/15-setup-posts-scheduling (#16)
Browse files Browse the repository at this point in the history
* feat(content): updating about page

* fix(build): build now takes in consideration dates

During build, the pages marked as "draft" are being skipped (if not server locally). This commit adds one more check - if the post's date is in the future (compared to build time).

This allows scheduling posts
  • Loading branch information
codenomnom authored Sep 17, 2023
1 parent 99814b6 commit 281f96c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 63 deletions.
40 changes: 24 additions & 16 deletions 11ty/plugins/drafts.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ function eleventyComputedPermalink() {
// When using `addGlobalData` and you *want* to return a function, you must nest functions like this.
// `addGlobalData` acts like a global data file and runs the top level function it receives.
return (data) => {
// Always skip during non-watch/serve builds
if(data.draft && !process.env.BUILD_DRAFTS) { // || data.page.date >= new Date()
return false;
const now = new Date();
if (!process.env.BUILD_DRAFTS) { // it's not local dev/serve build, so we need to be careful
if (data.draft) {
return false;
}
if (data.page.date >= now) {
return false;
}
}

return data.permalink;
Expand All @@ -15,9 +20,14 @@ function eleventyComputedExcludeFromCollections() {
// When using `addGlobalData` and you *want* to return a function, you must nest functions like this.
// `addGlobalData` acts like a global data file and runs the top level function it receives.
return (data) => {
// Always exclude from non-watch/serve builds
if(data.draft && !process.env.BUILD_DRAFTS) { // || data.page.date >= new Date()
return true;
const now = new Date();
if (!process.env.BUILD_DRAFTS) { // it's not local dev/serve build, so we need to be careful
if (data.draft) {
return true;
}
if (data.page.date >= now) {
return true;
}
}

return data.eleventyExcludeFromCollections;
Expand All @@ -28,21 +38,19 @@ module.exports.eleventyComputedPermalink = eleventyComputedPermalink;
module.exports.eleventyComputedExcludeFromCollections = eleventyComputedExcludeFromCollections;

module.exports = eleventyConfig => {
eleventyConfig.addGlobalData("eleventyComputed.permalink", eleventyComputedPermalink);
eleventyConfig.addGlobalData("eleventyComputed.eleventyExcludeFromCollections", eleventyComputedExcludeFromCollections);
eleventyConfig.addGlobalData('eleventyComputed.permalink', eleventyComputedPermalink);
eleventyConfig.addGlobalData('eleventyComputed.eleventyExcludeFromCollections', eleventyComputedExcludeFromCollections);

let logged = false;
eleventyConfig.on("eleventy.before", ({runMode}) => {
let text = "Excluding";
// Only show drafts in serve/watch modes
if(runMode === "serve" || runMode === "watch") {
eleventyConfig.on('eleventy.before', ({runMode}) => {
let text = 'Excluding';
if (runMode === 'serve' || runMode === 'watch') { // only show drafts in serve/watch modes
process.env.BUILD_DRAFTS = true;
text = "Including";
text = 'Including';
}

// Only log once.
if(!logged) {
console.log( `[11ty/eleventy-base-blog] ${text} drafts.` );
if (!logged) {
console.log( `[11ty/quirks-mode] ${text} drafts.` );
}

logged = true;
Expand Down
39 changes: 5 additions & 34 deletions content/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,11 @@ eleventyNavigation:

Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.

## Code
## Name

### Styled (with Syntax)

Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring.

```js
// this is a command
function myCommand() {
let counter = 0;
counter++;
}

// Test with a line break above this line.
console.log('Test');
```

### Unstyled

Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring.

```
// this is a command
function myCommand() {
let counter = 0;
counter++;
}
// Test with a line break above this line.
console.log('Test');
```

## Section Header

Capitalize on low hanging fruit to identify a ballpark value added activity to beta test. Override the digital divide with additional clickthroughs from DevOps. Nanotechnology immersion along the information highway will close the loop on focusing solely on the bottom line.
If you don't know what the name means, then you're lucky!

A long, long time ago, there weren't many browsers to browse the web, and they didn't agree on how to show a page on the screen.

[Quirks Mode](https://en.wikipedia.org/wiki/Quirks_mode) was a special mode used to denote how the browser should process the web page. Not fun enough? Here are some of the things that we used to "configure" the browser: `<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">`
27 changes: 14 additions & 13 deletions public/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ footer {
justify-content: space-between;

margin-top: auto;
padding-top: 5rem;
padding-bottom: 1rem;
padding-top: 12px;
padding-bottom: 12px;

font-size: 12px;
color: #6b7280;
Expand Down Expand Up @@ -168,9 +168,9 @@ section#tags-page--main ul li {
/*p:last-child {*/
/* margin-bottom: 0;*/
/*}*/
/*p {*/
/* line-height: 1.5;*/
/*}*/
p {
line-height: 23px;
}

/*li {*/
/* line-height: 1.5;*/
Expand Down Expand Up @@ -232,6 +232,15 @@ time {
word-spacing: -1px;
}

/*h1 > code, a > code*/
code {
font-family: inherit;
font-size: inherit;
padding: 3px 5px;
background: #E8E8E8;
border-radius: 2px;
}

pre,
code {
font-family: var(--font-family-monospace);
Expand All @@ -254,11 +263,3 @@ pre:not([class*="language-"]) {
code {
word-break: break-all;
}

h1 > code, a > code {
font-family: inherit;
font-size: inherit;
padding: 3px 5px;
background: #E8E8E8;
border-radius: 2px;
}

0 comments on commit 281f96c

Please sign in to comment.