diff --git a/assets/js/link-share.js b/assets/js/link-share.js
new file mode 100644
index 0000000..8e57875
--- /dev/null
+++ b/assets/js/link-share.js
@@ -0,0 +1,7 @@
+async function linkShare(t, u, s){
+let data = {title: t,text: s,url: u};
+if(navigator.canShare(data)){
+ try {await navigator.share(data);} catch (er) {console.error(er);}
+}else if (navigator?.clipboard?.writeText){
+ try {await navigator.clipboard.writeText(u);} catch (err) {console.error(err);}
+}else{console.log("Neither WebShare API nor CLipboard API is supported")}}
\ No newline at end of file
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index f2dc647..d3efb97 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -36,14 +36,15 @@
{{ else -}}
{{ $script := $main | minify | fingerprint -}}
- {{ end }}
- {{ range .Params.custom_js -}}
-
- {{- end }}
+ {{- end -}}
+ {{- if and (not (eq .Site.Params.shareSocial nil)) (.Site.Params.shareSocial) -}}
+ {{ $linkShareJS := resources.Get "js/link-share.js" -}}
+ {{ $linkshare := $linkShareJS | minify | fingerprint -}}
+
+ {{- end -}}
+ {{ range .Params.custom_js -}}{{- end }}
{{ partial "mathjax.html" . }}
- {{- if templates.Exists "partials/extra-foot.html" -}}
- {{ partial "extra-foot.html" . }}
- {{- end }}
+ {{- if templates.Exists "partials/extra-foot.html" -}}{{ partial "extra-foot.html" . }}{{- end }}