Spaces:
Sleeping
Sleeping
| {{ "<!-- fediverse.html -->" | safeHTML }} | |
| {{- $instance := .instance }} | |
| {{- $user := .user }} | |
| {{- $post := .post }} | |
| {{- $tootContent := .tootContent }} | |
| {{- $commentUrl := .commentUrl }} | |
| <details id="comments" class="presentation" aria-label="{{ i18n "comments" }}" open> | |
| <summary class="section-title" role="button" aria-expanded="true" aria-controls="mastodon-comments-list"> | |
| <span>{{ i18n "comments" }}</span> | |
| </summary> | |
| <code class="verbose" aria-hidden="true" hidden> | |
| <div class="has-aria-label-top" aria-label="Source:"> | |
| <span>https://</span><span id="metadata-instance">{{ $instance }}</span> | |
| <span>/@</span><span id="metadata-user">{{ $user }}</span> | |
| <span>/</span><span id="metadata-post">{{ $post }}</span> | |
| </div> | |
| <div id="i18n--no-comment" class="has-aria-label-top" aria-label="[l10n] if no comment to display:"> | |
| {{- i18n "noComment" -}} | |
| </div> | |
| <div id="i18n--is-loading" class="has-aria-label-top loading" aria-label="[l10n] if comments is loading:"> | |
| {{- i18n "fediverseIsLoading" -}} | |
| </div> | |
| <div id="i18n--is-replies" class="has-aria-label-top" aria-label="[l10n] replies:"> | |
| {{- i18n "replies" }} | |
| </div> | |
| <div id="i18n--is-reblogs" class="has-aria-label-top" aria-label="[l10n] reblogs:"> | |
| {{- i18n "reblogs" }} | |
| </div> | |
| <div id="i18n--is-favourites" class="has-aria-label-top" aria-label="[l10n] favorites:"> | |
| {{- i18n "favourites" }} | |
| </div> | |
| </code> | |
| <article id="discussion-starter"> | |
| <div data-pagefind-body>{{ $tootContent | safeHTML }}</div> | |
| <footer> | |
| <a id="join-discussion" href="{{ $commentUrl }}" rel="nofollow" data-post-counter=""> | |
| <span>{{ i18n "ctaComments" }}</span> | |
| </a> | |
| <div id="mastodon-stats" class="stat" aria-live="polite"></div> | |
| </footer> | |
| </article> | |
| <div id="mastodon-comments-list" role="feed" aria-busy="true" aria-label="{{ i18n "comments" }}"></div> | |
| <noscript> | |
| <div id="comments-error" role="alert">{{ i18n "noScript" }} {{ i18n "noComment" }}</div> | |
| </noscript> | |
| {{ partialCached "partials/fediverse/js.html" . }} | |
| </details> | |
| {{/*-------------------- end of fediverse.html ---------------------*/}} | |
| {{- define "partials/fediverse/js.html" -}} | |
| {{ "<!-- fediverse/js.html -->" | safeHTML }} | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/dompurify/2.4.1/purify.min.js" referrerpolicy="no-referrer" | |
| integrity="sha512-uHOKtSfJWScGmyyFr2O2+efpDx2nhwHU2v7MVeptzZoiC7bdF6Ny/CmZhN2AwIK1oCFiVQQ5DA/L9FSzyPNu6Q==" crossorigin="anonymous" ></script> | |
| {{- $fediverse := resources.Get "js/fediverse.js" | minify }} | |
| {{- if eq hugo.Environment "development" }} | |
| <script src="{{ $fediverse.Permalink }}" defer></script> | |
| {{- else }} | |
| {{- with $fediverse | fingerprint "sha384" }} | |
| <script src="{{ $fediverse.Permalink }}" | |
| integrity="{{ .Data.Integrity }}" crossorigin="anonymous" | |
| defer></script> | |
| {{- end }} | |
| {{- end }} | |
| {{- end }} | |
| {{- define "partials/fediverse/instance.html" -}} | |
| {{- $instance := or .Params.Fediverse.Host .Params.Fediverse.Instance site.Params.fediverse.instance site.Params.fediverse.host }} | |
| {{- $commentUrl := or .Params.toot .Params.comment }} | |
| {{- if $commentUrl }} | |
| {{- $toot := split (replaceRE "^https?://" "" .Params.toot) "/" }} | |
| {{- $instance = index $toot 0 }} | |
| {{- end }} | |
| {{- return $instance }} | |
| {{- end }} | |
| {{- define "partials/fediverse/username.html" -}} | |
| {{- $username := or .Params.Fediverse.User .Params.Fediverse.Username site.Params.fediverse.username site.Params.fediverse.user }} | |
| {{- $commentUrl := or .Params.toot .Params.comment }} | |
| {{- if $commentUrl }} | |
| {{- $toot := split (replaceRE "^https?://" "" .Params.toot) "/" }} | |
| {{- $username = trim (index $toot 1) "@" }} | |
| {{- end }} | |
| {{- return $username }} | |
| {{- end }} | |
| {{- define "partials/fediverse/post.html" -}} | |
| {{- $post := or .Params.Fediverse.post .Params.Fediverse.link }} | |
| {{- $commentUrl := or .Params.toot .Params.comment }} | |
| {{- if $commentUrl }} | |
| {{- $toot := split (replaceRE "^https?://" "" .Params.toot) "/" }} | |
| {{- $post = index $toot 2 }} | |
| {{- end }} | |
| {{- return $post }} | |
| {{- end }} |