<!DOCTYPE html> <html lang=“{{ site.lang }}”> <head> <meta charset=“UTF-8” /> <meta content=“width=device-width, initial-scale=1, shrink-to-fit=no” name=“viewport” /> <meta name='csrf-token' content='' />

<script>

if (window.innerWidth > 451) {
  document.querySelector("meta[name='viewport']").setAttribute('content', 'width=1100');
}

</script>

{% if page.noindex %}<meta content=“noindex, nofollow” name=“robots” />{% endif %} <!–

Generated {{ 'now' | date: "%Y-%m-%d %H:%M %:z (%Z)" }}
Layout {{ page.layout }}

–> {% comment %}Use via `JEKYLL_ENV=production bundle exec jekyll serve`{% endcomment %} {% comment %}TODO: Since GCE, this does not do anything for staging. We dont have a staging ATM. We left the code to make it easier to add a staging later.{% endcomment %} {% if jekyll.environment == 'production' %}

{% assign hostname = 'https://www.betterplace.org' %}
{% assign style_host = 'https://www.betterplace.org' %}

{% elsif jekyll.environment == 'staging' %}

{% assign hostname = 'https://www.bp42.com' %}
{% assign style_host = 'https://www.bp42.com' %}

{% endif %}

{% comment %}Avoid redirect loop. We cannot have URLs ending in “/” since we redirect those with 302. But our “<root>/index.html” files are translated to “<root>/” since page.url is “/” for index.html. This creates the loop for the facebook-debugger for example. Using this clean_page_url solves the problem for the “<root>/index”. For “<root>/<folder>/index” we have a different solution: we need to add a “permalink”-front-matter that has the same name as the folder, which also removes the trailing “/”. Update 2019-07-19: Another problem that came us is, that URLs endet in .html which also caused a redirect loop. We solve this by removing the .html from the URL.{% endcomment %} {% capture clean_page_url %}{% if page.url == '/' %}#{% else %}{{ page.url | replace:'.html','' }}{% endif %}{% endcapture %}

<title>{{ page.title | default:'betterplace.org' }}</title>

{% if page.alternate_url %} {% for item in page.alternate_url %} <link rel=“alternate” hreflang=“{{ item | replace:'_','-' }}” href=“{{ item | replace:'www.betterplace.org’,hostname }}”> {% endfor %} {% endif %}

{% if page.canonical_url %} <link rel=“canonical” href=“{{ page.canonical_url }}”> {% else %} <link rel=“canonical” href=“{{ hostname }}{{ site.baseurl }}{{ clean_page_url }}”>{% comment %}So stellen wir sicher, dass wir nicht versehentlich eine content-LOREM.betterplace.org Domain im Index haben.{% endcomment %} {% endif %}

{% comment %}Das content–theme legt die default.css für jedes repo ab. Nicht geil, aber OK.{% endcomment %} <link rel=“stylesheet” href=“{{ style_host }}{{ site.baseurl }}/assets/css/default.css” />

{% comment %}Für das Layout “landingpage” haben wir eine zusätzliche Datei {% endcomment %} {% if page.layout == 'landingpage' or page.layout == 'lpm-styleguide' %} <link rel=“stylesheet” href=“{{ style_host }}{{ site.baseurl }}/assets/css/landingpage_modules.css” /> {% endif %}

{% if site._options.content.styles %} <link rel=“stylesheet” href=“{{ style_host }}{{ site.baseurl }}{{ site._options.content.styles }}” /> {% endif %}

<link rel=“stylesheet” href=“{{ style_host }}/de/layouts/current_stylesheet/utils” />

<link rel=“shortcut icon” href=“” />

{{ page.head_include }}{{ site.head_include }}{{ layout.head_include }}

{% include sharing.html sharing_host=hostname clean_page_url=clean_page_url %}

{% if site.feed_meta_in_head %}{% feed_meta %}{% endif %}

{% include schema_org_structured_data.html %}

</head> {% assign transparent_header = page.transparent_header | default: site.transparent_header %} <body class=“{% if page.url contains '404' %} error404 {% else %} {{ site.css_root }} {% endif %}{% if transparent_header %} has-transparent-header {% endif %}”> <div id=“fb-root”></div>

<div class='fixed-viewport-width bg-white'>

{% include subnavi-helper.html hostname=hostname %}

{{ content }}

{% capture other_lang %}

{% if site.lang == 'de' %}English{% else %}Deutsch{% endif %}

{% endcapture %}

{% capture language_switch_content %}

{% if page.alternate_url %}
  {% if site.translation_lang == 'de' %}
    {% if page.alternate_url contains 'de_DE' %}
      {% assign translation = 'de_DE' %}
    {% else %}
      {% assign translation = 'de' %}
    {% endif %}
  {% else %}
    {% assign translation = site.translation_lang %}
  {% endif %}
  <a onclick="ga(&#39;send&#39;, &#39;event&#39;, &#39;navigation header&#39;, &#39;{{ page.alternate_url[translation] | replace:'https://www.betterplace.org','' }}&#39;);" class="language-switcher" href="{{ page.alternate_url[translation] | replace:'https://www.betterplace.org',hostname }}">{{ other_lang }}</a>
{% else %}
  <span style="text-decoration: line-through; color: #cccccc;" class="language-switcher">{{ other_lang }}</span>
{% endif %}

{% endcapture %}

{% capture footer %}

{% include footer-{{ site.lang }}.html hostname=hostname %}

{% endcapture %}

{{ footer | replace_first:'<!–language-switch-content–>',language_switch_content }}

{% include cookie_banner.html %}

</div>

<script src=“{{ style_host }}/de/layouts/current_pack/utils”></script> <script src=“{{ style_host }}/de/layouts/current_pack/locale_{{ site.lang }}”></script> <script src=“{{ style_host }}/de/layouts/current_pack/homepage”></script> <script>

// Make sure we can test the Rails-staging CSS on jekyll-staging.
{% comment -%}
  //  For Staging: Simulate the environment by replacing the URLs.
  //  For Development: This does nothing, unless you force `JEKYLL_ENV=production`.
  // This will also replace URLs like the navbar logo URL which is a nice extra.
  // The attribute data-host-replaced=true is meant as a heads up when using the inspector that something was change here.
  // We cannot use the same logic for JS – more at https://github.com/betterplace/content--theme/commit/cff6293.
  // We work around checking for bp42 here to not expose the staging domain.
  //   www.betterplace.org, .dev: do nothing
  //   app.cloudcannon.com, proxy.cloudcannon.com: do nothing
  //   www.bp42.com: replace
{% endcomment -%}
const prd  = window.location.hostname.indexOf('.org') !== -1
const dev  = window.location.hostname.indexOf('.dev') !== -1
const edit = window.location.hostname.indexOf('.cloud') !== -1
if (!prd && !dev && !edit) {
  document.querySelectorAll("[href]").forEach(element => {
    if (element.href.includes('www.betterplace.org')) {
      element.href = element.href.replace('www.betterplace.org', window.location.hostname)
      element.setAttribute('data-host-replaced', 'true')
    }
  })
}

</script>

</body> </html>