💄 style(webmentions): remove extra spaces and format script tag

- remove unnecessary spaces and adjust indentation for consistency
- format script tag to improve readability

 feat(webmentions): add greeting text to webmentions container

- include "hello" text within the webmentions container for initial display
This commit is contained in:
Jeremiah Russell 2025-05-12 07:59:32 +01:00
parent d3d5e2439e
commit c190f4001d
No known key found for this signature in database
GPG key ID: E576B835ACE207E5

View file

@ -1,7 +1,7 @@
{# Incorporate webmention.io links and script into the page head. {# Incorporate webmention.io links and script into the page head.
1. Provide the link to the webmention data in the at webmention.io. 1. Provide the link to the webmention data in the at webmention.io.
2. Link to the stylesheet for styling webmentions on a page. 2. Link to the stylesheet for styling webmentions on a page.
3. Add and configure the javascript to fetch and display the webmentions collected at webmention.io. #} 3. Add and configure the javascript to fetch and display the webmentions collected at webmention.io. #}
<link rel="webmention" href="https://webmention.io/{{ config.extra.webmentions.domain }}/webmention" /> <link rel="webmention" href="https://webmention.io/{{ config.extra.webmentions.domain }}/webmention" />
@ -10,46 +10,42 @@
{% set script_data = "" %} {% set script_data = "" %}
{% if config.extra.webmentions.id %} {% if config.extra.webmentions.id %}
{% set script_data = script_data ~ "data-id=" ~ config.extra.webmentions.id %} {% set script_data = script_data ~ "data-id=" ~ config.extra.webmentions.id %}
{% endif %} {% endif %}
{% if config.extra.webmentions.page_url %} {% if config.extra.webmentions.page_url %}
{% set script_data = script_data ~ " data-page-url=" ~ config.extra.webmentions.page_url %} {% set script_data = script_data ~ " data-page-url=" ~ config.extra.webmentions.page_url %}
{% endif %} {% endif %}
{% if config.extra.webmentions.add_urls %} {% if config.extra.webmentions.add_urls %}
{% set script_data = script_data ~ "data-add-urls=" ~ config.extra.webmentions.add_urls %} {% set script_data = script_data ~ "data-add-urls=" ~ config.extra.webmentions.add_urls %}
{% endif %} {% endif %}
{% if config.extra.webmentions.wordcount %} {% if config.extra.webmentions.wordcount %}
{% set script_data = script_data ~ " data-wordcount=" ~ config.extra.webmentions.wordcount %} {% set script_data = script_data ~ " data-wordcount=" ~ config.extra.webmentions.wordcount %}
{% endif %} {% endif %}
{% if config.extra.webmentions.max_webmentions %} {% if config.extra.webmentions.max_webmentions %}
{% set script_data = script_data ~ "data-max-webmentions=" ~ config.extra.webmentions.max_webmentions %} {% set script_data = script_data ~ "data-max-webmentions=" ~ config.extra.webmentions.max_webmentions %}
{% endif %} {% endif %}
{% if config.extra.webmentions.prevent_spoofing %} {% if config.extra.webmentions.prevent_spoofing %}
{% set script_data = script_data ~ "data-prevent-spoofing=" ~ config.extra.webmentions.prevent_spoofing %} {% set script_data = script_data ~ "data-prevent-spoofing=" ~ config.extra.webmentions.prevent_spoofing %}
{% endif %} {% endif %}
{% if config.extra.webmentions.sort_by %} {% if config.extra.webmentions.sort_by %}
{% set script_data = script_data ~ "data-sort-by=" ~ config.extra.webmentions.sort_by %} {% set script_data = script_data ~ "data-sort-by=" ~ config.extra.webmentions.sort_by %}
{% endif %} {% endif %}
{% if config.extra.webmentions.sort_dir %} {% if config.extra.webmentions.sort_dir %}
{% set script_data = script_data ~ "data-sort-dir=" ~ config.extra.webmentions.sort_dir %} {% set script_data = script_data ~ "data-sort-dir=" ~ config.extra.webmentions.sort_dir %}
{% endif %} {% endif %}
{% if config.extra.webmentions.comments_are_reactions %} {% if config.extra.webmentions.comments_are_reactions %}
{% set script_data = script_data ~ " data-comments-are-reactions=" ~ config.extra.webmentions.comments_are_reactions %} {% set script_data = script_data ~ " data-comments-are-reactions=" ~ config.extra.webmentions.comments_are_reactions %}
{% endif %} {% endif %}
<script <script async src="{{ get_url(path='js/webmention.min.js', trailing_slash=false) | safe }}" {{ script_data }}>
async
src="{{ get_url(path='js/webmention.min.js', trailing_slash=false) | safe }}"
{{ script_data }}
>
</script> </script>
{%- set format = config.extra.webmentions.format | default(value="") -%} {%- set format = config.extra.webmentions.format | default(value="") -%}
@ -59,4 +55,4 @@
{%- set dash = "-" -%} {%- set dash = "-" -%}
{% endif %} {% endif %}
<div class="webmentions-container" id="webmentions{{ dash}}{{ format }}"></div> <div class="webmentions-container" id="webmentions{{ dash}}{{ format }}">hello</div>