Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sidebar to page template #308

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from

Conversation

haringsrob
Copy link
Contributor

@haringsrob haringsrob changed the base branch from master to 2.x August 27, 2019 12:05
@haringsrob
Copy link
Contributor Author

Tagged with ecl2 because the target is 2.x

@@ -33,7 +35,12 @@
<section class="main-content ecl-u-mv-l">
<div class="ecl-container">
<div class="ecl-row">
<div class="ecl-col">
{% if page.sidebar %}
<div class="ecl-col-12 ecl-col-lg-3">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://ec.europa.eu/component-library/ec/templates/pages/search/code/ this div should be an aside and we should change the main by a section.

@ademarco
Copy link
Member

ademarco commented Aug 27, 2019

I would not add a sidebar in the main theme. Still this is a good occasion to improve our theme to be more extensible by sub-themes (which, I guess, you are using @haringsrob).

In order to do that we could maybe rework this PR using Twig blocks on the page template, so that you could simply override a content block in your page template that extends our.

If you are ok with this approach please consider updating the documentation too.

Copy link
Member

@ademarco ademarco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above.

@haringsrob
Copy link
Contributor Author

haringsrob commented Aug 27, 2019

Can be done by adding a page.html.twig to your subtheme.

{% set _main_content_class = page.sidebar ? 'ecl-col-12 ecl-col-lg-9' : 'ecl-col' %}

{% block content %}
  <section class="main-content ecl-u-mv-l">
    <div class="ecl-container">
      <div class="ecl-row">
        {% if page.sidebar %}
          <div class="ecl-col-12 ecl-col-lg-3">
            {{ page.sidebar }}
          </div>
        {% endif %}
        <div class="{{ _main_content_class }}">
          {{ page.content }}
        </div>
      </div>
    </div>
  </section>
{% endblock %}

And adding the region to the subtheme.info.yml

  sidebar: "Sidebar"

I still feel that on top of this theme a subset of functions can be provided to site builders that allow easier configuration of these sort of pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants