Search code examples
ruby-on-railslocomotivecms

How do I view a page created in locomotivecms


I created a page in locomotivecms, under my app/views/pages folders and called it page2.liquid.haml and it contains the following code.

 {% extends 'index' %}

{% block 'main' %}This is the content for the page 2{% endblock %}

I can view the index page, but I am not sure how to view page2 in the browser everything I try leads to a 404.

Any Ideas?


Solution

  • Above the liquid markup, you need to have a YAML file header with the page's title, slug, and published flag, like this:

    ---
    title: Page 2
    slug: page2
    published: true
    ---
    {% extends 'index' %}
    
    {% block 'main' %}This is the content for the page 2{% endblock %}
    

    You can create files with such headers generated automatically by using the wagon generate page command.

    $ bundle exec wagon generate page test_page