commit 6a1dd65d3f1651c590852922ee4a38048f43182f
parent 71e43130e9a09cd4a5c09daeb6b02e2d728b5ca8
Author: Shimmy Xu <shimmy.xu@shimmy1996.com>
Date: Mon, 18 May 2020 18:27:49 -0500
Add webmention form
Diffstat:
5 files changed, 43 insertions(+), 6 deletions(-)
diff --git a/README.org b/README.org
@@ -2,6 +2,7 @@
Hyperskip adds email-powered static comments for Hugo.
** Usage
+*** Installation
Clone this repository to your themes folder (typically =themes= from Hugo root),
and add Hyperskip to the list of themes (yes, you can use a list of theme names)
in Hugo configuration. Here's an example when using TOML format config
@@ -24,6 +25,7 @@ templates
{{ partial "hyperskip_feed.html" . }}
#+END_SRC
+*** Comment Format
The theme expects to find =data/comments.toml= in Hugo directory with the
following format:
#+BEGIN_SRC toml
@@ -69,3 +71,11 @@ storing the entire hash value, an inherent security risk.
By default, form data is sent using URL encoding in body of the email. An easy
way to convert it back is to use =urllib.parse.unquote= in Python.
+
+*** Webmention
+Hyperskip also includes a form for submitting Webmentions. To enable it, specify
+Webmention endpoint in your site's =config.toml= (or equivalent) like so:
+#+BEGIN_SRC toml
+ [params]
+ webmentionEndpoint = "https://your-webmention-endpoint/"
+#+END_SRC
diff --git a/i18n/en.toml b/i18n/en.toml
@@ -20,4 +20,10 @@ other = "Reply"
other = "At least 3 characters. Markdown is supported."
[hyperskip-placeholder]
-other = "No comments yet."-
\ No newline at end of file
+other = "No comments yet."
+
+[hyperskip-webmention]
+other = "Alternatively, [respond](https://indieweb.org/responses) on your own site and let me know the URL:"
+
+[hyperskip-webmention-submit]
+other = "Send Webmention"+
\ No newline at end of file
diff --git a/i18n/ja.toml b/i18n/ja.toml
@@ -20,4 +20,10 @@ other = "返信"
other = "3文字以上。Markdownサポートがあります。"
[hyperskip-placeholder]
-other = "まだコメントはありません。"-
\ No newline at end of file
+other = "まだコメントはありません。"
+
+[hyperskip-webmention]
+other = "または、自分のサイトで[レスポンス](https://indieweb.org/responses)して、URLを知らせてください:"
+
+[hyperskip-webmention-submit]
+other = "ウェブメンションで投稿"+
\ No newline at end of file
diff --git a/i18n/zh.toml b/i18n/zh.toml
@@ -20,4 +20,10 @@ other = "回复"
other = "至少三个字符。支持 Markdown 语法。"
[hyperskip-placeholder]
-other = "暂时没有评论。"-
\ No newline at end of file
+other = "暂时没有评论。"
+
+[hyperskip-webmention]
+other = "或者在您自己的网站上[回应](https://indieweb.org/responses),并把网址告诉我吧:"
+
+[hyperskip-webmention-submit]
+other = "发送Webmention"+
\ No newline at end of file
diff --git a/layouts/partials/comment_form.html b/layouts/partials/comment_form.html
@@ -13,6 +13,15 @@
placeholder="{{ i18n "hyperskip-requirement"}}"></textarea></p>
<p><input type="submit" value="{{ i18n "hyperskip-submit"}}"></p>
</form>
+{{ with $.Site.Params.webmentionEndpoint }}
+<form action="{{ . }}"
+ method="post" target="_blank">
+ <p><label for="link">{{ i18n "hyperskip-webmention" | markdownify }}</label><br/>
+ <input type="url" id="link" name="source" placeholder="https://foo.bar/baz"/></p>
+ <input type="hidden" name="target" value="{{ $.Page.Permalink }}">
+ <p><input type="submit" value="{{ i18n "hyperskip-webmention-submit" }}"/></p>
+</form>
+{{ end }}
<script>
function reply(hash, name) {
document.forms.comment_form.comment.value += "[Re: " + name + "](#" + hash + ")\n";