Draft Blog Functionality

This Jekyll blog now supports a draft system that allows you to create posts that are hidden from the main blog listing but still accessible via direct URL for private sharing.

Configuration

The draft blog URL is configurable in _config.yml:

# Draft blog configuration
draft_blog_url: /draft  # Default value, can be changed

How It Works

Creating Draft Posts

Posts are marked as drafts using the draft: true front matter:

---
layout: post
title: "My Draft Post"
draft: true
date: 2025-01-01 12:00:00 -0800
categories: [example, testing]
tags: [draft, test]
description: >
  This is a draft post that won't appear in the main blog.
---

What Happens to Draft Posts

Draft posts are:

  • Excluded from the main /blog/ listing
  • Excluded from the RSS feed (/feed.xml)
  • Excluded from related posts
  • Excluded from random posts
  • Excluded from category/tag listings
  • Included in the /draft/ listing (configurable URL)
  • Accessible via direct URL for sharing

Accessing Draft Posts

Draft Blog Listing

Visit /draft/ (or your configured URL) to see all draft posts in a clean, organized list.

Direct URLs

Draft posts are still accessible via their normal URLs for sharing:

  • Example: /blog/example/testing/2025-01-01-my-draft-post/

Use Cases

Private Sharing

Share draft posts with specific people by sending them the direct URL without the post appearing in public listings.

Content Review

Allow reviewers to access draft content for feedback before publication.

Staged Publishing

Prepare content in advance and control when it becomes publicly visible.

Publishing a Draft

To publish a draft post, simply remove the draft: true line from the front matter:

---
layout: post
title: "My Published Post"
date: 2025-01-01 12:00:00 -0800
categories: [example, testing]
tags: [published, live]
---

Technical Implementation

Files Modified

  • _config.yml - Added draft blog URL configuration
  • _layouts/blog.html - Excludes draft posts from main blog
  • _layouts/list.html - Excludes draft posts from category/tag listings
  • _layouts/draft-blog.html - New layout for draft blog listing
  • draft/index.html - Draft blog index page
  • feed.xml - Custom RSS feed excluding draft posts
  • _includes/components/related-posts.html - Excludes drafts from related posts
  • _includes/pro/related-posts.html - Excludes drafts from pro related posts
  • _includes/pro/random-posts.html - Excludes drafts from random posts

Filter Logic

The system uses Liquid filters to exclude posts where draft == true:



Example Draft Post

Here’s an example of a complete draft post:

---
layout: post
title: "This is a Draft Post"
date: 2025-06-30
categories: [example, testing]
tags: [draft, test]
description: >
  This is an example draft post that should only appear in the draft blog listing.
draft: true
image:
  path: /assets/img/blog/example-image.jpg
sitemap: false
---

# This is a Draft Post

This post has `draft: true` in its front matter, which means it will only appear in the `/draft/` listing and be accessible via direct URL for private sharing.

## Features

- Hidden from main blog listing
- Excluded from RSS feeds
- Not included in related/random posts
- Still accessible via direct URL
- Appears in draft blog listing

Benefits

  1. Privacy Control: Share content privately without public exposure
  2. Content Staging: Prepare and review content before publication
  3. Collaborative Review: Enable feedback on drafts before going live
  4. SEO Friendly: Draft posts include sitemap: false to avoid indexing
  5. Clean Separation: Clear distinction between published and draft content

The draft functionality provides a professional workflow for content management while maintaining the simplicity of Jekyll’s static site generation.


© 2025, Ramin Firoozye. All rights reserved.