aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfabrixxm <fabrix.xm@gmail.com>2020-10-08 15:01:09 +0200
committerfabrixxm <fabrix.xm@gmail.com>2020-10-08 15:01:09 +0200
commit509a656b6fcde12d40aabaffe81dfe64ca9dfbf1 (patch)
treeb993b274e056b309894977b74642be52e3a7602d
parent4279f1078df48fc17d837947546dc67d32ec3b15 (diff)
Template per entry, permalink
-rw-r--r--templates/web/base.html97
-rw-r--r--templates/web/entry.html20
-rw-r--r--templates/web/index.html105
3 files changed, 129 insertions, 93 deletions
diff --git a/templates/web/base.html b/templates/web/base.html
new file mode 100644
index 0000000..bbb6d93
--- /dev/null
+++ b/templates/web/base.html
@@ -0,0 +1,97 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="referrer" content="origin">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <!-- <link rel="stylesheet" type="text/css" href="links.css"> -->
+ <link rel="shortcut icon" href="favicon.ico">
+ <link rel="alternate" type="application/rss+xml" title="RSS" href="/rss">
+ <title>{% block title %}{% endblock %}</title>
+ <style>
+ html { width: 100%; }
+ body {
+ width: 100%; max-width: 80ch; margin: 1em auto;
+ font-family: Verdana, Geneva, sans-serif;
+ font-size: 12pt;
+ color: #828282;
+ }
+
+ a:link { color: #000; text-decoration: none; }
+ a:hover { text-decoration: underline; }
+
+ header > h1 {
+ font-size: 1em;
+ margin:0;
+ display: inline-block;
+ }
+
+ body > header {
+ color: #000;
+ background-color: #82a9d2;
+ padding: 0 1em;
+ line-height: 2em;
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ }
+ body > header > h1 > a { color: #000; }
+
+
+ body > section,
+ body > article {
+ padding: 1em;
+ background-color: #f2f2f2;
+ border-bottom: 2px solid #82a9d2;
+ }
+
+ body > article header h1 { font-size: 1.5em; }
+ body > article header aside { font-size: 0.8em; }
+
+ #linkslist { margin: 0; }
+ #linkslist dd {
+ margin: 0.2em 0 1em 0;
+ }
+ body > article footer,
+ #linkslist dd > footer {
+ font-size: 0.8em;
+ margin-top: 0.2em;
+ }
+
+ #linkslist a:link { color: #000; }
+
+ a.tag {
+ line-height: 1.2em;
+ padding: 0 0.2em;
+ border: 1px solid #828282;
+ background-color: #E2E2E2;
+ border-radius: 3px;
+ color: #828282;
+ text-decoration: none;
+ }
+ a.tag:hover { color: #000; }
+
+
+ #nextpage { color: #828282; }
+
+ .placeholder { text-align: center; }
+
+ body > footer {
+ margin-top: 2em;
+ text-align: center;
+ }
+
+ </style>
+
+ {% block extrahead %}{% endblock %}
+ </head>
+ <body>
+ <header>
+ <h1><a href="{{ url_for('index') }}">Linkopedia</a></h1>
+ <span>i Bookmark del <a href="https://gl-como.it/">GL-Como</a></span>
+ </header>
+ {% block content %}{% endblock %}
+ <footer>
+ <form method="get" action="{{ url_for('search') }}"><input name="q" placeholder="cerca..."></form>
+ </footer>
+ </body>
+</html>
diff --git a/templates/web/entry.html b/templates/web/entry.html
new file mode 100644
index 0000000..9fea0af
--- /dev/null
+++ b/templates/web/entry.html
@@ -0,0 +1,20 @@
+{% extends "base.html" %}
+
+{% block title %}Linkopedia{% endblock %}
+
+{% block content %}
+ <article>
+ <header>
+ <h1><a href="{{ entry.data.url }}">{{ entry.data.title }}</a></h1>
+ <aside>{{ entry.data.url }}</aside>
+ </header>
+ <p>{{ entry.data.description }}</p>
+ <footer>
+ {{ entry.data.added }}
+ {{ "- tags: " if entry.data.tags|count > 0 }}
+ {% for tag in entry.data.tags %}
+ <a class="tag" href="{{ url_for('search') }}?q=tag:{{tag|urlencode}}">{{ tag }}</a>
+ {% endfor %}
+ </footer>
+ </article>
+{% endblock %}
diff --git a/templates/web/index.html b/templates/web/index.html
index 3339479..3301763 100644
--- a/templates/web/index.html
+++ b/templates/web/index.html
@@ -1,102 +1,24 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta name="referrer" content="origin">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <!-- <link rel="stylesheet" type="text/css" href="links.css"> -->
- <link rel="shortcut icon" href="favicon.ico">
- <link rel="alternate" type="application/rss+xml" title="RSS" href="/rss">
+{% extends "base.html" %}
- <title>Linkopedia</title>
- <style>
- html { width: 100%; }
- body {
- width: 100%; max-width: 80ch; margin: 1em auto;
- font-family: Verdana, Geneva, sans-serif;
- font-size: 12pt;
- color: #828282;
- }
+{% block title %}Linkopedia{% endblock %}
- a:link { color: #000; text-decoration: none; }
- a:hover { text-decoration: underline; }
-
- body > header {
- color: #000;
- background-color: #82a9d2;
- padding: 0 1em;
- line-height: 2em;
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- }
- body > header > h1 {
- font-size: 1em;
- margin:0;
- display: inline-block;
- }
- body > header > h1 > a { color: #000; }
-
- body > section {
- padding: 1em;
- background-color: #f2f2f2;
- border-bottom: 2px solid #82a9d2;
- }
- #linkslist { margin: 0; }
- #linkslist dd {
- margin: 0.2em 0 1em 0;
- }
- #linkslist dd > footer {
- font-size: 0.8em;
- margin-top: 0.2em;
- }
-
- #linkslist a:link { color: #000; }
-
- #linkslist a.tag {
- line-height: 1.2em;
- padding: 0 0.2em;
- border: 1px solid #828282;
- background-color: #E2E2E2;
- border-radius: 3px;
- color: #828282;
- text-decoration: none;
- }
- #linkslist a.tag:hover { color: #000; }
-
-
- #nextpage { color: #828282; }
-
- .placeholder { text-align: center; }
-
- body > footer {
- margin-top: 2em;
- text-align: center;
- }
-
- </style>
- </head>
- <body>
- <header>
- <h1><a href="{{ url_for('index') }}">Linkopedia</a></h1>
- <span>I Bookmark del <a href="https://gl-como.it/">GL-Como</a></span>
- </header>
+{% block content %}
<section>
{% if q %}<h2>Cerca: '{{ q }}'</h2>{% endif %}
<dl id="linkslist">
{% for entry in entries %}
- {% set doc = entry.get_data() %}
- <dt class="link" id="{{ doc.eid }}">
- <a href="{{ doc.url }}" title="{{ doc.url }}">{{ doc.title }}</a>
+ <dt class="link" id="{{ entry.eid }}">
+ <a href="{{ entry.data.url }}" title="{{ entry.data.url }}">{{ entry.data.title }}</a>
</dt>
<dd>
- {{ doc.description }}
+ {{ entry.data.description }}
<footer>
- {{ doc.added }}
- {{ "-" if doc.tags|count > 0 }}
- {% for tag in doc.tags %}
+ {{ entry.data.added }} - <a href="{{ url_for('entry', eid=entry.eid) }}">permalink</a>
+ {{ "-" if entry.data.tags|count > 0 }}
+ {% for tag in entry.data.tags %}
<a class="tag" href="{{ url_for('search') }}?q=tag:{{tag|urlencode}}">{{ tag }}</a>
{% endfor %}
- </footer>
+ </footer>
</dd>
{% endfor %}
</dl>
@@ -110,8 +32,5 @@
<div class="placeholder">nessun risultato</div>
{% endif %}
</section>
- <footer>
- <form method="get" action="{{ url_for('search') }}"><input name="q" placeholder="cerca..."></form>
- </footer>
- </body>
-</html>
+{% endblock %}
+