diff options
| -rw-r--r-- | doc/administration/custom-pages.rst | 21 | ||||
| -rw-r--r-- | fietsboek/views/default.py | 13 | 
2 files changed, 34 insertions, 0 deletions
diff --git a/doc/administration/custom-pages.rst b/doc/administration/custom-pages.rst index 87d4c7c..db92c49 100644 --- a/doc/administration/custom-pages.rst +++ b/doc/administration/custom-pages.rst @@ -105,6 +105,27 @@ directory will be included:      fietsboek.pages =          /fietsboek/pages/ +Overwriting the Home Page +------------------------- + +If you set a slug of ``/``, you can overwrite Fietsboek's custom home page: + +.. code:: markdown + +    Title: Home +    Slug: / +    Link-name: home + +    Welcome to Fietsboek! +    ===================== + +Note that you can use the same ``Locale`` and ``Show-to`` filters for the home +page as you can for other custom pages. If no matching home page is found, +Fietsboek will fall back to the default. + +When defining your own home page, make sure to still include it in the +configuration! +  Tips & Tricks  ------------- diff --git a/fietsboek/views/default.py b/fietsboek/views/default.py index f61b95c..a36e4c3 100644 --- a/fietsboek/views/default.py +++ b/fietsboek/views/default.py @@ -26,6 +26,19 @@ def home(request):      :rtype: pyramid.response.Response      """      if not request.identity: +        # See if the admin set a custom home page +        page = request.pages.find('/', request) +        if page is not None: +            return render_to_response( +                'fietsboek:templates/static-page.jinja2', +                { +                    'title': page.title, +                    'content': Markup(page.content), +                }, +                request, +            ) + +        # Show the default home page          locale = request.localizer.locale_name          content = util.read_localized_resource(locale, "html/home.html")          return {  | 
