Often we create a custom settings form with stuff like social media url's or addresses. With this snippet you make the variables available in your page.twig.html file. In your mytheme.theme file:

/**
 * Implements hook_preprocess_page().
 */
function MYTHEME_preprocess_page(&$variables) {
  $variables['instagram_url'] = \Drupal::config('mysite.settings')->get('instagram_url');
}

Now, in your page.html.twig file, just use

{{ instagram_url }}

to print the url.


Saved you some valuable time?

Donate and get more free time-saving code on this website in the future.