Search code examples
content-management-systemgrav

How to make a single site page with gravstrap?


I am using the theme gravstrap for Grav CMS.

I want to make a single page website, like in this example :
http://gravstrap.diblas.net/gravstrap-theme-simple-page-example

I looked at the brief blog post explaining how to do it and also at the source code example on the project git repo.

I am having a hard time to undertand what to do exactly because what the blog-post says seems quite different than what I see in the example (especially how to link pages to menu items with the id thing).


Solution

  • I finally got it working :

    Create a page with the template page_navbar_interne, create sub-pages as modular, each sub-page will be section.

    By default sections will be ordered by the names of the folders. You can hardcode the order by adding this in the Frontmatter (expert mode) :

    title: Single page website
    published: true
    slug: single-page-slug
    content:
        items: '@self.modular'
        order:
            by: default
            dir: asc
            custom:
                - _header
                - _mySection2
                - _myOtherSection
    

    To display the menu to navigate to the sections, you have to use navbar2 instead of navbar1, in the header module.

    [g-navbar id="navbar2" name=navbar2 fixed=top centering=none brand_text="…" render=false]
        [g-navbar-menu name=menu0 alignment="center" onepage=true attributes="class:highdensity-menu"][/g-navbar-menu]
        [g-navbar-menu name=menu1 icon_type="fontawesome" alignment="right" ]
            [g-link url="…" icon_type="fontawesome" icon="…"][/g-link]
            …
        [/g-navbar-menu]
    [/g-navbar]