Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

One-Page Site Skeleton linking the features

Started by Muut Archive 11 years ago · 1 replies · 373 views
11 years ago

Hi there (again),

I would like to add links to the features (with those lovely icons) of the One-Page Skeleton. How could I manage this?

THX in advance

11 years ago

First you would need to add some links in the yaml frontmatter of the features.md page (using links to valid pages of course):

YAML
features:
    - header: Markdown Syntax
      icon: text-height
      link: /features/markdown-syntax
    - header: Twig Templating
      icon: code
      link: /features/twig-templating
    - header: Smart Caching
      icon: rocket
      link: /features/smart-caching
...

Then in your theme's templates/modular/features.html.twig file you would have to read those links and use them (see the link around the feature.header:

TWIG
<div class="modular-row features {{ page.header.class}}"> 
    {{ content }}
    <div class="feature-items">
    {% for feature in page.header.features %}
           <div class="feature">
            {% if feature.icon %}
            <i class="fa fa-fw fa-{{ feature.icon }}"></i>
            <div class="feature-content icon-offset">
            {% else %}
            <div class="feature-content">
            {% endif %}
            {% if feature.header %}
            <h4><a href="{{ base_url }},{{ feature.link }}">{{ feature.header }}</a></h4>
            {% endif %}
            {% if feature.text %}
            <p>{{ feature.text }}</p>
            {% endif %}
            </div>
        </div>
    {% endfor %}
    </div>
</div>

That would then link your title to the page you set. Of course if not everyone had a link you would have to add some logic to test if a link exists first.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1328 9 years ago
Archive · by Muut Archive, 9 years ago
2 921 9 years ago
Archive · by Muut Archive, 9 years ago
2 4050 9 years ago
Archive · by Muut Archive, 9 years ago
1 2928 9 years ago
Archive · by Muut Archive, 9 years ago
3 1107 9 years ago