summaryrefslogtreecommitdiff
path: root/layouts/_partials/posts
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/_partials/posts')
-rw-r--r--layouts/_partials/posts/fediverse-form.html20
1 files changed, 4 insertions, 16 deletions
diff --git a/layouts/_partials/posts/fediverse-form.html b/layouts/_partials/posts/fediverse-form.html
index 6c4fce6a..6d545088 100644
--- a/layouts/_partials/posts/fediverse-form.html
+++ b/layouts/_partials/posts/fediverse-form.html
@@ -9,24 +9,12 @@
<script>
function openInFediverse() {
const instance = document.getElementById('fediverse-instance').value.trim();
- {{ with .Params.toot }}
- const tootUrl = '{{ . }}';
- {{ else }}
- const tootUrl = '';
- {{ end }}
+ const tootUrl = '{{ .Params.toot }}';
- if (!instance) {
- alert('Please enter your Fediverse instance URL');
- return;
+ let url = tootUrl
+ if (instance) {
+ url = 'https://' + instance + '/authorize_interaction?uri=' + encodeURIComponent(tootUrl);
}
-
- if (!tootUrl) {
- alert('No toot available for this post');
- return;
- }
-
- // Open the toot interaction page on the user's instance
- const url = 'https://' + instance + '/authorize_interaction?uri=' + encodeURIComponent(tootUrl);
window.open(url, '_blank');
}
</script>