user1487254
user1487254

Reputation: 21

Generating only a subset of posts in DocPad

I have seen folks using docpad for blogging, but didn't find a ready to use blogging framework. While Docpad compares to Jekyll, which are static site generators, I wanted something like Octopress which is purely a blogging framework. So I started building one gathering good parts from several repos.

While everything works great, my main problem is, if I add a new post (creating a ".md" file in "src/documents/posts" directory) and perform "docpad run", docpad parses every ".md" file and converts all of them to "html". I have at least 400 blog posts and it takes a lot of time, just to add a new post. Is there a way in which I could generate just the newly added file instead of re-generating the entire set of files? Appreciate your inputs.

Upvotes: 2

Views: 206

Answers (1)

balupton
balupton

Reputation: 48679

The reasoning for this is that you must be using a layout that contains a listing of other documents, in which case modifying a document means that you are at risk of such listings becoming stale.

The ultimate solution to this is tracking specifically which documents reference specifically which other documents, and specifically which attributes they reference. Currently, we just register a boolean flag of whether they do or not. Issue #336 is established to figure out how to do this. Currently I am unaware of any other static site generator that implements this, they generally just opt for keeping content lists out of date, or the existing boolean solution we implement.

In the meantime, there are a few solutions:

  1. Add the standalone: true meta data to your blog posts, you can do this automatically with something like this. This attribute will disable the default DocPad reference checks on this document, so if it is modified, DocPad will not add documents that reference others to the regeneration queue.

  2. Use a manual instead of automated content listing for your layout. Keeping automated content listings (those that use custom collections) for content listing pages like a blog listing page, rather than in layouts. Keep layouts using manual listing (where you define the listing manually in your docpad configuration file's templateData property) instead.

We're open to other suggestions on this as well. Please participate in Issue #336 to add your thoughts on how this could be improved. Hope that helps.

Upvotes: 3

Related Questions