Skip to content

Commit

Permalink
D8CORE-7255 exclude lazy load oembed links from external links (#760)
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish authored Feb 9, 2024
1 parent d8932c3 commit 675e558
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/sync/extlink.settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extlink_include: ''
extlink_class: 'su-link su-link--external'
extlink_label: ' (link is external)'
extlink_img_class: false
extlink_css_exclude: '.localist-widget, #lclst_widget_footer'
extlink_css_exclude: '.localist-widget, #lclst_widget_footer, .oembed-lazyload__button'
extlink_css_explicit: '#page-content, .su-local-footer'
extlink_mailto_class: mailto
extlink_mailto_label: ' (link sends email)'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{#
/**
* @file
* Default theme implementation of a an oembed lazyload placeholder.
*
* Available variables:
* - title: The oembed resource title.
* - url: The oembed resource url.
* - provider: The provider of the oembed content.
* - settings: The configured formatter settings.
* - third_party_settings: Any third party settings passed on by a specific provider.
*
* @see template_preprocess_oembed_lazyload_placeholder()
*
* @ingroup themeable
*/
#}
{% apply spaceless %}
{% if title is empty %}
{% set title = '' %}
{% endif %}
{% if settings['strategy'] == 'onclick' %}
<button class="oembed-lazyload__button" title="{% trans %}Watch {{ title }}{% endtrans %}">
<span class="oembed-lazyload__visible-label">{% trans %}Load video{% endtrans %}</span>
{% if title %}
<span class="visually-hidden">{{ title }}</span>
{% endif %}
<span class="oembed-lazyload__thumbnail" style="background-image: url('{{ thumbnail }}')"></span>
</button>
{% else %}
<a class="oembed-lazyload__button" href="{{ url }}" aria-label="{% trans %}Watch {{ title }}{% endtrans %}" rel="nofollow">
<span class="oembed-lazyload__thumbnail" style="background-image: url('{{ thumbnail }}')"></span>
</a>
{% endif %}
{% endapply %}

0 comments on commit 675e558

Please sign in to comment.