Home

>

Tools

>

Ghost

>

Releases

>

1.4.0

Ghost Release: 1.4.0

Tag Name: 1.4.0

Release Date: 8/2/2017

Ghost LogoGhost

Open-source publishing platform specifically designed for professional bloggers and publications. Focuses on clean, minimalist writing and publishing experience.

TL;DR

Ghost 1.4.0: Per-Post Code Injection & Performance Improvements

Ghost 1.4.0 introduces the highly requested per-post code injection feature, allowing developers and content creators to add custom code to individual posts. This release also includes significant performance improvements by reducing the size of release builds, fixes for pagination issues that were causing duplicate content, and improvements to custom post excerpts. These changes enhance both the developer experience and content management capabilities while maintaining Ghost's commitment to performance and reliability.

Highlight of the Release

    • Per-post code injection for custom styling and functionality on individual posts
    • Significant reduction in release build size by excluding development assets
    • Fixed pagination issues that were causing duplicate content
    • Proper handling of custom post excerpt lengths
    • Updated configuration file location from config.js to config.[env].json

Migration Guide

Migration Notes

Configuration File Location Change

  • The configuration file has moved from config.js to config.[env].json
  • If you have custom configuration settings, ensure they are migrated to the new location
  • Update any scripts or documentation that reference the old configuration file location

Database Migration for Per-Post Code Injection

  • Ghost 1.4.0 includes a database migration to add two new fields for per-post code injection
  • The migration will run automatically when upgrading
  • No manual steps are required for this migration

Ghost-Admin Development Assets

  • Development versions of Ghost-Admin are no longer included in release builds
  • If you need to debug or modify Ghost-Admin, you should check it out from git directly
  • See the official documentation for working with the admin client

Upgrade Recommendations

This release is recommended for all Ghost users. The introduction of per-post code injection provides significant new functionality, while the performance improvements and bug fixes enhance the overall experience.

Who should upgrade immediately:

  • Users who need per-post code customization capabilities
  • Sites experiencing issues with pagination or custom excerpt lengths
  • Installations where release size and performance are critical factors

Upgrade Process:

  1. Back up your Ghost installation and database before upgrading
  2. Follow the standard Ghost upgrade process
  3. Note that configuration files have moved from config.js to config.[env].json
  4. No additional manual steps are required for this upgrade

The upgrade should be straightforward with no breaking changes reported.

Bug Fixes

Fixed Pagination with Letters Duplicating Content

  • Fixed an issue where URLs like /page/2abc/ were being interpreted as /page/2/
  • These malformed URLs now correctly return 404 errors instead of showing duplicate content
  • This prevents potential SEO issues with duplicate content
  • Added tests to ensure this behavior remains fixed

Fixed Custom Post Excerpt Length

  • Fixed a bug where custom post excerpts were being truncated to the default 50 characters
  • Custom excerpts now maintain their intended length
  • Added additional tests to verify this functionality

Fixed Global and Post Code Injection Output

  • Resolved an issue with the output of combined global and post-specific code injections
  • When a custom post code injection is defined, both global and post-specific code are now correctly output

New Features

Per-Post Code Injection

Ghost 1.4.0 introduces one of the most requested features: per-post code injection. This powerful enhancement allows you to add custom code (HTML, CSS, JavaScript) to individual posts, rather than only being able to inject code site-wide.

  • Two new database fields have been added to store custom header and footer code for each post
  • Both global and post-specific code injections are now properly combined in the output
  • This enables advanced customization for individual posts such as:
    • Custom styling for specific content
    • Post-specific JavaScript functionality
    • Integration of third-party widgets on a per-post basis
    • Special formatting or interactive elements for featured content

This feature significantly enhances the flexibility of Ghost for developers and content creators who need fine-grained control over the presentation and functionality of individual posts.

Security Updates

No specific security fixes were included in this release.

Performance Improvements

Optimized Release Builds

  • Ghost release builds no longer include Ghost-Admin development assets
  • This change significantly reduces the size of release builds
  • Speeds up installation and update processes
  • Ensures the server can still run in both production and development modes
  • The admin default-prod.html file is now copied to default.html as part of the release task

This optimization is particularly beneficial for installations with limited resources or bandwidth constraints. Development builds aren't useful in release zips (especially when the sourcemaps are stripped from releases) - if deep debugging or changes are to be made in Ghost-Admin, it should be checked out from git as per the official documentation.

Impact Summary

Ghost 1.4.0 represents a significant enhancement to the platform's flexibility and performance. The introduction of per-post code injection addresses a long-standing feature request, giving developers and content creators unprecedented control over individual post presentation and functionality.

The performance improvements from excluding development assets in release builds will benefit all users, particularly those on resource-constrained hosting environments. This change aligns with Ghost's commitment to maintaining a fast, efficient publishing platform.

Bug fixes for pagination and custom excerpt handling resolve issues that could potentially impact SEO and content presentation. These fixes ensure that Ghost continues to provide a reliable publishing experience.

Overall, this release enhances Ghost's position as a powerful, flexible publishing platform while maintaining its focus on performance and user experience. The changes primarily benefit developers and content creators who need fine-grained control over their content, while also improving the experience for all users through performance enhancements and bug fixes.

Full Release Notes

  • ✨ Code Injection per Post feature
  • 🎨 Improved theme validation messages
  • 🎨 Don't include Ghost-Admin development assets in release build
  • 🐛 Fixed custom post excerpt length
  • 🐛 Fixed pagination w/ letters duplicating content

You can see the full change log for the details of every change included in this release.

Statistics:

File Changed17
Line Additions316
Line Deletions45
Line Changes361
Total Commits10

User Affected:

  • Can now inject custom code on a per-post basis
  • Will benefit from smaller release builds without development assets
  • Need to be aware that config.js is now config.[env].json

Contributors:

ErisDSvikaspotluri123kevinansfieldkirrg001aileen