/**
* Implements template_preprocess_paragraph().
*
* @param array $variables
* An associative array containing:
* - elements: An array of elements to display in view mode.
* - paragraph: The paragraph object.
* - view_mode: View mode; e.g., 'full', 'teaser'...
*/
function MYTHEME_preprocess_paragraph(&$variables) {
/** @var \Drupal\paragraphs\Entity\Paragraph $paragraph */
$paragraph = $variables['paragraph'];
// Get the type
$parentBundle = $paragraph->bundle();
if($parentBundle == 'carousel') {
// Add variables here
$variables['sitename'] = \Drupal::config('system.site')->get('name');
}
}
After this, in you paragraph--type--carousel.html.twig you can use:
{{ sitename }}