Repos / pytaku / ba26f9a28a
commit ba26f9a28a9e49afae463749d93134fea874b1ec
Author: Bùi Thành Nhân <hi@imnhan.com>
Date: Tue Aug 11 20:17:51 2020 +0700
try opengraph tags
diff --git a/src/mangoapi/mangadex.py b/src/mangoapi/mangadex.py
index 542a80e..fc0a246 100644
--- a/src/mangoapi/mangadex.py
+++ b/src/mangoapi/mangadex.py
@@ -1,3 +1,4 @@
+import html
import re
import requests
@@ -22,7 +23,9 @@ def get_title(self, title_id):
"site": "mangadex",
"cover_ext": cover_ext,
"alt_names": md_json["manga"]["alt_names"],
- "descriptions": md_json["manga"]["description"].split("\r\n\r\n"),
+ "descriptions": html.unescape(md_json["manga"]["description"]).split(
+ "\r\n\r\n"
+ ),
"chapters": [
{
"id": str(chap_id),
diff --git a/src/pytaku/static/base.css b/src/pytaku/static/base.css
index 530babd..63032dc 100644
--- a/src/pytaku/static/base.css
+++ b/src/pytaku/static/base.css
@@ -48,6 +48,10 @@ input {
padding: 0.3rem;
}
+p {
+ line-height: 1.5rem;
+}
+
.button {
display: inline-block;
user-select: none;
diff --git a/src/pytaku/templates/title.html b/src/pytaku/templates/title.html
index fb71962..559d939 100644
--- a/src/pytaku/templates/title.html
+++ b/src/pytaku/templates/title.html
@@ -1,6 +1,10 @@
{% extends 'base.html' %}
{% block head %}
+<meta property="og:title" content="{{ name }} - Pytaku" />
+<meta property="og:image" content="{{ cover }}" />
+<meta property="og:description" content="{{ descriptions | join('\n') }}" />
+
<style>
.cover {
width: 400px;
@@ -41,6 +45,7 @@ <h1>{{ name }}</h1>
</div>
<img class="cover" src="{{ cover }}" alt="cover" />
+<p class="description">{{ descriptions | join('\n') }}</p>
{% if chapters %}
<table>