Hiding pages

nanoc complete ignores pages that have is_draft set to true. This is useful when writing new blog posts that shouldn’t be published yet. Draft pages are not compiled, and are not included in the @pages array.

It is sometimes useful to compile pages, but not let them show up in the sitemap or feed. At Stoneship, the feed is hidden, so it doesn’t show up on the sitemap: only FeedBurner knows my hidden feed URL.

To do this, add is_hidden: "true" to the Custom section of the page’s meta file. By itself, this won’t do anything, but you can tell the sitemap and the feed to skip hidden pages.

For example, a sitemap can be told to skip hidden pages by replacing the line…

<% @pages.each do |page| %>

by…

<% @pages.reject { |p| p.is_hidden }.each do |page| %>

The same can be applied to feeds, where you get all @pages, select the articles, and reject the hidden pages.