Added share buttons
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
<a href="/" class="back-to-blog" title="Return to all posts">←</a>
|
||||
|
||||
<h2 class="post-title" itemprop="name headline">
|
||||
<a class="post-link" href="{{ path }}">{{ title }}</a>
|
||||
<a class="post-link" href="{{ path }}">{{ title }}</a> {{> share }}
|
||||
</h2>
|
||||
|
||||
<div class="post-meta feather_type">
|
||||
@@ -25,6 +25,9 @@
|
||||
</div>
|
||||
|
||||
</article>
|
||||
<div class="center">
|
||||
{{> share shareText='Share this post'}}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{{> footer }}
|
||||
@@ -52,5 +55,19 @@
|
||||
}
|
||||
|
||||
</script>
|
||||
<script>
|
||||
if (navigator.share) {
|
||||
[...document.querySelectorAll('.share')].forEach(function(shareButton) {
|
||||
shareButton.classList.add('show');
|
||||
shareButton.addEventListener('click', function(event) {
|
||||
event.preventDefault();
|
||||
navigator.share({
|
||||
title: document.title,
|
||||
url: window.location.url
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user