Posts

Showing posts with the label p14

manage content versioning in large Jekyll projects

Why does content versioning matter in Jekyll?

As your Jekyll site grows—especially for product documentation, APIs, or technical resources—users may need access to older versions of your content. You may also need to publish documentation for multiple releases side-by-side (e.g., v1.x, v2.x, v3.0-beta).

Without content versioning, updates overwrite past work. Readers get confused. Teams lose track of what changed when.

What are common versioning use cases?

  • Publishing documentation for multiple product versions
  • Maintaining legacy guides for deprecated features
  • Tracking content changes over time for audit or rollback
  • Labeling posts with release information

What’s the simplest way to version content in Jekyll?

Use **folder-based versioning** inside collections or custom directories. For example:


_docs/
  v1.0/
    getting-started.md
    faq.md
  v2.0/
    getting-started.md
    faq.md

Each versioned folder contains a full copy of docs scoped to that release. Use Liquid logic to generate version selectors and organize navigation.

How do you structure layouts for version-aware content?

Use the URL path or front matter to determine active version:


---
layout: docs
version: v2.0
title: "Getting Started"
---

Then in layout:


{% raw %}
{% assign current_version = page.version | default: 'latest' %}
{% include nav.html version=current_version %}
{% endraw %}

How do you build navigation for multiple versions?

Store versioned nav config in _data/docs/:


_data/docs/v1.0.yml
_data/docs/v2.0.yml

Then use:


{% raw %}
{% assign nav = site.data.docs[page.version] %}
{% for item in nav %}
  <a href="{{ item.url }}">{{ item.title }}</a>
{% endfor %}
{% endraw %}

This way, each version maintains its own nav without modifying layout logic.

How do you create a version switcher?

Detect available versions via folder or config list. Use a dropdown to switch:


site.data.versions.yml:
- v1.0
- v2.0
- latest

{% raw %}
<select onchange="location = this.value;">
  {% for v in site.data.versions %}
    <option value="/docs/{{ v }}/" {% if page.version == v %}selected{% endif %}>{{ v }}</option>
  {% endfor %}
</select>
{% endraw %}

How do you minimize duplication between versions?

  • Use shared includes and layouts
  • Keep common snippets in _includes/
  • Move data-driven blocks (like changelogs) to _data/

Avoid copy-pasting HTML or logic between versions. Only duplicate content when the text changes.

What about Git-based content history?

Jekyll doesn’t have a built-in changelog system—but Git does. Use Git to track:

  • Who edited which file
  • When a doc was changed
  • What content was removed or added

You can expose this info in the UI with a plugin or manually insert commit dates:


Last updated: {{ page.last_modified_at }}

If using GitHub Pages, GitHub’s API or webhooks can also expose commit history for content files.

How do you label and tag content for releases?

In front matter, include:


release: v2.1.0
status: stable

This lets you filter content by release, status (beta/stable/deprecated), or audience. Especially helpful when some pages apply to multiple versions.

How do you deploy or preview per version?

You can build and deploy each version as its own subdirectory:


/docs/v1.0/
/docs/v2.0/
/docs/latest/

Or deploy each version to its own branch and use GitHub Pages' branch-based hosting. For example:


- main → latest docs
- v1.0 → legacy docs
- v2.0 → staging docs

When should you archive versions?

If a version is no longer maintained:

  • Move it to an /archive/ section
  • Add a banner notice: “This version is no longer supported”
  • Remove it from default nav

Keep URLs live for reference and SEO, but signal to readers that it’s outdated.

Conclusion: How to build reliable versioning for Jekyll content?

A versioned content system is a must for growing sites—especially in technical, documentation, or product spaces. With smart folder structure, config separation, and metadata tagging, you can scale your site to support dozens of versions cleanly.

The key is this: keep content modular, layouts reusable, and versioning rules consistent. With that foundation, your Jekyll repo becomes a sustainable, multi-version publishing system.