## Simple social share icons D8. hook_preprocess(). ``` // Social share icons. if($hook == 'node') { if($vars['node']->getType() == 'resource') { global $base_root; $vars['base_root'] = $base_root; // $site_name = \Drupal::config('system.site')->get('name'); $vars['site_name'] = $site_name; } } ``` .html.twig ``` {% set node_title = node.getTitle() | url_encode %} {% set social_url = base_root ~ url %} {% set summary = content.body[0]['#text']|striptags %} {% set summary_url = summary|length > 140 ? summary|url_encode|slice(0, 140) ~ '...' : summary %}
```