Skip to content

Commit

Permalink
Merge pull request #368 from CTPUG/published-flag
Browse files Browse the repository at this point in the history
Add a published flag
  • Loading branch information
stefanor committed Aug 13, 2017
2 parents ea9026b + 168517d commit 43a74d0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/pages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,14 @@ e.g. ``pages/index.md``::

We invite you to [join us](/attend/) at [our venue](/venue/)
on the 31st of December for a day of fun conferencing.

The front matter can contain a couple of flags:

``published``
If set to ``false``, the page will not be loaded by the
``load_pages`` command.
``include_in_menu``
If set to ``true``, the page will be added to the menu structure.
``exclude_from_static``
If set to ``true``, the page will not be archived to static HTML by
:ref:`staticsitegen <staticsitegen>`.
2 changes: 2 additions & 0 deletions docs/static.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _staticsitegen:

======================
Static Site Generation
======================
Expand Down
2 changes: 2 additions & 0 deletions wafer/pages/management/commands/load_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def read_page(self, fn):
return meta, contents

def load_page(self, parent, slug, meta, content):
if not meta.get('published', True):
return
page, created = Page.objects.get_or_create(parent=parent, slug=slug)
page.name = meta['name']
page.content = content
Expand Down

0 comments on commit 43a74d0

Please sign in to comment.