Add reply via email button

This commit is contained in:
Gabriel Augendre 2021-12-27 22:41:32 +01:00
parent 74930d1e9f
commit 09f17bdef1
4 changed files with 20 additions and 0 deletions

View file

@ -81,6 +81,10 @@ class Article(models.Model):
def get_absolute_url(self):
return reverse("article-detail", kwargs={"slug": self.slug})
def get_mailto_url(self):
email = settings.BLOG["email"]
return f"mailto:{email}?subject={self.title}"
def get_abstract(self):
html = self.get_formatted_content
return html.split("<!--more-->")[0]

View file

@ -27,3 +27,13 @@ nav a:not(:first-child):before, a.tag:not(:first-of-type):before {
text-decoration: none;
display: inline-block;
}
#reply {
text-align: center;
margin-top: 2em;
}
#reply a button {
font-size: 1.2rem;
padding: 8px 16px;
}

View file

@ -15,6 +15,11 @@
{{ article.get_formatted_content|safe }}
</div>
</article>
<section id="reply">
<a href="{{ article.get_mailto_url }}&body={{ request.build_absolute_uri }}">
<button>✉️ Reply via email</button>
</a>
</section>
{% if article.get_related_articles %}
<section>
<hr>

View file

@ -216,6 +216,7 @@ AUTH_USER_MODEL = "articles.User"
BLOG = {
"title": "Gab's Notes",
"author": "Gabriel Augendre",
"email": "ga-notes@augendre.info",
"description": "My take on tech-related subjects (but not only).",
"base_url": env("BLOG_BASE_URL"),
"repo": {