How to Add a Title to Section and Tag Pages

Sometimes you might find the need to put a title on a section page. Here's an example:

Here's how to do it:

First, navigate to the section or tag page you want to modify.

Then, simply add "{{subpage.title}}" to the page as shown here:

     <div class="subpage_title">{{subpage.title}}</div>

Adding that div tag to the page enables the title of the section page to display. To add a div tag, use the Custom HTML element in the Layout & Design tool:

You can also use Jinja code within the Layout and Design tool so it is even easier to add sections: Tag Page

You might need to do the same thing for the Tag Page as shown here:

To do this, JavaScript is required. Here's a code example:

    <script type="text/javascript">
    var segment_str = window.location.pathname;
    segment_str=segment_str.replace(/\/+$/, "");
    var segment_array = segment_str.split( '/' );
    var last_segment = segment_array[segment_array.length - 1];
    last_segment = last_segment .split('-').join(' ');
    document.querySelector('.top-tag-title').innerHTML=last_segment;
    </script>

Where there's a Custom HTML element present — such as <div class="top-tag-title"></div> — this will be the position of the heading. This applies to styling as well.

If you have any questions about how to implement this, email support@rebelmouse.com.

Other Articles