templates/includes/blocks/share.html.twig line 1

  1. {#<?php
  2. $url urlencode('https://example.org'); // TODO: This URL has to be the current url that should be shared
  3. $title urlencode('post title'); // TODO: This is the title of the post.
  4. $linkedin_url sprintf('https://www.linkedin.com/shareArticle?url=%s&title=%s'$url$title);
  5. $twitter_url sprintf('https://twitter.com/share?url=%s&text=%s'$url$title);
  6. $email_url sprintf('mailto:?to=&body=%s&subject=%s'$url$title);
  7. ?>#}
  8. {% set url = absolute_url(app.request.requesturi) | url_encode %}
  9. {% set title = pageTitle | url_encode %}
  10. {% set linkedinUrl = 'https://www.linkedin.com/shareArticle?url=%s&title=%s' | format(url, title) %}
  11. {% set twitterUrl = 'https://twitter.com/share?url=%s&text=%s' | format(url, title) %}
  12. {% set emailUrl = 'mailto:?to=&body=%s&subject=%s' | format(url, title) %}
  13. <div class="container-small {{ content.top }} {{ content.bottom }}">
  14. {#    dump vars #}
  15.     {#<div style="font-size: 1.7rem;">
  16.         <h2>{{ url }}</h2> <br>
  17.         <h2>{{ title }}</h2> <br>
  18.         <h2>{{ linkedinUrl }}</h2> <br>
  19.         <h2>{{ twitterUrl }}</h2> <br>
  20.         <h2>{{ emailUrl }}</h2><br>
  21.         <h2>{{ pageTitle }}</h2>
  22.     </div>#}
  23.     <div class="share">
  24.         <a href="{{ linkedinUrl }}" class="button button--pink button--size-secondary button--icon"
  25.            target="_blank" rel="noopener noreferrer">
  26.         <span class="button__inner">
  27.             <svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
  28.                 <path d="M22.223 0H1.772C.792 0 0 .773 0 1.73v20.536C0 23.222.792 24 1.772 24h20.451c.98 0 1.777-.778 1.777-1.73V1.73C24 .773 23.203 0 22.223 0ZM7.12 20.452H3.558V8.995H7.12v11.457ZM5.34 7.434a2.064 2.064 0 1 1 0-4.125 2.063 2.063 0 0 1 0 4.125Zm15.112 13.018h-3.558v-5.57c0-1.326-.024-3.037-1.852-3.037-1.851 0-2.133 1.449-2.133 2.944v5.663H9.356V8.995h3.413v1.566h.047c.473-.9 1.636-1.852 3.365-1.852 3.605 0 4.27 2.372 4.27 5.457v6.286Z" fill="currentColor" />
  29.             </svg>
  30.         </span>
  31.         </a>
  32.         <a href="{{ twitterUrl }}" class="button button--pink button--size-secondary button--icon"
  33.            target="_blank" rel="noopener noreferrer">
  34.         <span class="button__inner">
  35.             <svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 20">
  36.                 <path d="M7.533 19.857A13.93 13.93 0 0 1 0 17.659c1.847.12 5.107-.166 7.135-2.1-3.05-.14-4.426-2.48-4.606-3.48.26.1 1.496.22 2.193-.06C1.214 11.14.675 8.062.795 7.122c.658.46 1.774.62 2.213.58C-.262 5.36.915 1.843 1.493 1.083c2.346 3.25 5.862 5.076 10.213 5.178a5.024 5.024 0 0 1-.126-1.12A4.992 4.992 0 0 1 16.564.143c1.438 0 2.734.611 3.644 1.588.96-.225 2.407-.752 3.114-1.208-.356 1.28-1.466 2.347-2.137 2.743.006.013-.005-.014 0 0 .59-.09 2.185-.396 2.815-.824-.312.72-1.488 1.915-2.453 2.584.18 7.921-5.881 14.831-14.014 14.831Z" fill="currentColor" />
  37.             </svg>
  38.         </span>
  39.         </a>
  40.         <a href="{{ emailUrl }}" class="button button--pink button--size-secondary button--icon" target="_blank" rel="noopener noreferrer">
  41.         <span class="button__inner">
  42.             <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
  43.                 <path fill="currentColor" d="m20 8-8 5-8-5V6l8 5 8-5m0-2H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2Z" />
  44.             </svg>
  45.         </span>
  46.         </a>
  47.     </div>
  48. </div>