1
0
mirror of https://github.com/tiyn/beaker-blog.git synced 2025-10-16 12:51:16 +02:00

Compare commits

..

19 Commits

Author SHA1 Message Date
910e6bcc0a styling: improved link color in footer 2024-04-20 01:08:47 +02:00
9d11c25bf1 styling: improved date on standalone articles 2024-04-20 01:02:40 +02:00
00686923b4 requirements: removed unnecessary dependencies 2024-04-19 23:39:10 +02:00
8796169ff7 added search page, updated style 2024-04-19 23:36:01 +02:00
a936fd5ee6 fixed minor error with short title 2024-04-15 05:16:50 +02:00
d7a8db3d77 added imprint, improved css for it 2024-04-15 04:59:03 +02:00
d61c3dc66d css paddings and margins improved 2024-04-15 04:04:21 +02:00
bb0f71e9a4 change time to modify so it can be changed 2024-04-15 03:44:48 +02:00
039b945589 improved padding for figures 2024-04-15 03:27:10 +02:00
488602b4e2 updated css 2024-04-14 20:03:11 +02:00
b598b99c73 added favicon 2024-04-14 02:42:36 +02:00
1adad6762d improve style for code 2024-04-14 02:27:53 +02:00
e151dac3da make logo standard 2024-04-14 02:23:10 +02:00
98249bbbd9 added language support for german 2024-04-14 01:58:29 +02:00
1ac2ba220a improved light style for better readability 2024-04-14 00:44:27 +02:00
4679305c51 added more style and fixed a link bug 2024-04-14 00:31:07 +02:00
d83f66ab3d update automatically 2024-04-13 23:55:10 +02:00
6c586c6a89 minor style changes, added graphics volume 2024-04-13 23:41:02 +02:00
472d8c74c6 readme: fixed typo 2022-07-30 23:57:15 +02:00
22 changed files with 717 additions and 219 deletions

View File

@@ -8,8 +8,20 @@ WORKDIR /blog
RUN pip3 install -r requirements.txt
RUN apt-get update && \
apt-get install -y locales && \
sed -i -e 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen && \
sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
VOLUME /blog/templates/entry
VOLUME /blog/static/graphics
EXPOSE 5000
ENTRYPOINT [ "python3" ]

View File

@@ -13,6 +13,9 @@ via plain text files.
- [x] HTML files (.html)
- [x] Markdown Files (.md)
- [x] Infinite-scroll blog page
- [x] Search page
- [x] Full-text search
- [x] Preview panel
- [x] Archive page
- [x] Months as headings
- [x] Links to scrolling blog page
@@ -26,6 +29,9 @@ via plain text files.
- [x] Switchable CSS
- [x] CSS dark-theme
- [x] CSS light-theme
- [x] Language Support
- [x] English
- [x] German
- [x] Config file
- [x] Docker installation
- [x] Logo
@@ -58,12 +64,13 @@ The `config.py` can be found in the `src` folder.
Set the following volumes with the -v tag.
| Volume-Name | Container mount | Description |
| ------------- | --------------------------- | ------------------------------------------------------------ |
| `config-file` | `/blog/src/config.py` | Config file |
| `entries` | `/blog/src/templates/entry` | Directory for blog entries |
| `css` | `/blog/src/static/css` | (optional) Directory for css files |
| `html` | `/blog/src/templates` | (optional) Directory for templates (entry-volume not needed) |
| Volume-Name | Container mount | Description |
| ------------- | ----------------------- | ------------------------------------------------------------ |
| `config-file` | `/blog/config.py` | Config file |
| `entries` | `/blog/templates/entry` | Directory for blog entries |
| `graphics` | `/blog/static/graphics` | Directory for images needed for entries |
| `css` | `/blog/static/css` | (optional) Directory for css files |
| `html` | `/blog/templates` | (optional) Directory for templates (entry-volume not needed) |
#### Ports

View File

@@ -6,4 +6,6 @@ docker run --name beaker-blog \
--restart unless-stopped \
-p "5000:5000" \
-e FLASK_ENV=development \
-v entries:/blog/templates/entry \
-v graphics:/blog/static/graphics \
-d tiyn/beaker-blog

View File

@@ -1,53 +1,117 @@
from flask import Flask, make_response, render_template, abort
from flask import Flask, abort, make_response, render_template, request
from flask_font_awesome import FontAwesome
import content as con_gen
import config
app = Flask(__name__)
import content as con_gen
from forms import SearchForm, register_csrf
TITLE = config.TITLE
STITLE = config.STITLE
STYLE = config.STYLE
LANGUAGE = config.LANGUAGE
DESCRIPTION = config.DESCRIPTION
WEBSITE = config.WEBSITE
MAIL = config.MAIL
app = Flask(__name__)
register_csrf(app)
font_awesome = FontAwesome(app)
@app.errorhandler(404)
def page_not_found(e):
return render_template("error.html", title=TITLE, errorcode="404", style=STYLE), 404
return render_template("error.html",
title=TITLE,
stitle=STITLE,
errorcode="404",
style=STYLE,
language=LANGUAGE), 404
@app.route("/")
@app.route("/index.html")
def index():
content = con_gen.gen_index_string()
return render_template("index.html", title=TITLE, content_string=content, style=STYLE)
content = con_gen.gen_index_string()
return render_template("index.html",
title=TITLE,
stitle=STITLE,
content_string=content,
style=STYLE,
language=LANGUAGE)
@app.route("/search", methods=["GET", "POST"])
@app.route("/search.html", methods=["GET", "POST"])
def search():
form = SearchForm()
if request.method == "POST":
query_str = request.form["query_str"]
content = con_gen.gen_query_res_string(query_str)
return render_template("search.html",
title=TITLE,
stitle=STITLE,
style=STYLE,
form=form,
content=content,
language=LANGUAGE), 200
return render_template("search.html",
title=TITLE,
stitle=STITLE,
style=STYLE,
form=form,
content="",
language=LANGUAGE), 200
@app.route("/imprint")
@app.route("/imprint.html")
def imprint():
return render_template("imprint.html",
title=TITLE,
stitle=STITLE,
mail=MAIL,
style=STYLE,
language=LANGUAGE)
@app.route("/archive")
@app.route("/archive.html")
def archive():
content = con_gen.gen_arch_string()
return render_template("archive.html", title=TITLE, content_string=content, style=STYLE)
content = con_gen.gen_arch_string()
return render_template("archive.html",
title=TITLE,
stitle=STITLE,
content_string=content,
style=STYLE,
language=LANGUAGE)
@app.route("/entry/<path>")
def entry(path):
content = con_gen.gen_stand_string(path)
if content != "":
return render_template("standalone.html", title=TITLE, content_string=content, style=STYLE)
abort(404)
content = con_gen.gen_stand_string(path)
if content != "":
return render_template("standalone.html",
title=TITLE,
stitle=STITLE,
content_string=content,
style=STYLE,
language=LANGUAGE)
abort(404)
@app.route("/feed.xml")
@app.route("/rss.xml")
def feed():
content = con_gen.get_rss_string()
rss_xml = render_template("rss.xml", content_string=content, title=TITLE,
description=DESCRIPTION, website=WEBSITE)
response = make_response(rss_xml)
response.headers["Content-Type"] = "application/rss+xml"
return response
content = con_gen.get_rss_string()
rss_xml = render_template("rss.xml",
content_string=content,
title=TITLE,
description=DESCRIPTION,
website=WEBSITE)
response = make_response(rss_xml)
response.headers["Content-Type"] = "application/rss+xml"
return response
if __name__ == "__main__":
app.run(host="0.0.0.0")
app.run(host="0.0.0.0")

View File

@@ -1,6 +1,9 @@
# Name/title of your blog
TITLE = "Beaker Blog"
# Short name/title of your blog
STITLE = "Beaker Blog"
# Description for RSS of your blog
DESCRIPTION = "This is your personal Beaker Blog."
@@ -9,3 +12,12 @@ WEBSITE = "localhost:5000"
# Theme for the blog: dark, light
STYLE = "dark"
# Language for the titles: en-us or de-de
LANGUAGE = "en-us"
# Mail address for the imprint
MAIL = "dummy@mail.com"
# Directory to store entries in
ENTRY_DIR = "templates/entry"

View File

@@ -1,97 +1,100 @@
from datetime import datetime
import markdown
import locale
import os
from os import path
import pathlib
from datetime import datetime
from os import path
import markdown
import config
import search
ENTRY_DIR = config.ENTRY_DIR
LANGUAGE = config.LANGUAGE
LOCAL = "de_DE.UTF-8" if LANGUAGE == "de-de" else "en_US.UTF-8"
locale.setlocale(locale.LC_TIME, LOCAL)
ENTRY_DIR = "templates/entry"
def gen_arch_string():
"""
"""
Creates and returns a archive string of every file in ENTRY_DIR.
Returns:
string: html-formatted archive-string
"""
path_ex = ENTRY_DIR
if path.exists(path_ex):
name_list = os.listdir(path_ex)
full_list = [os.path.join(path_ex, i) for i in name_list]
contents = sorted(full_list, key=os.path.getctime)
content_string = ""
last_month = ""
for file in reversed(contents):
curr_date = datetime.fromtimestamp(
os.path.getctime(file)).strftime("%Y-%m-%d")
curr_month = datetime.fromtimestamp(
os.path.getctime(file)).strftime("%b %Y")
if curr_month != last_month:
if last_month != "":
content_string += "</ul>\n"
content_string += "<h2>" + curr_month + "</h2>\n"
content_string += "<ul>\n"
last_month = curr_month
filename = pathlib.PurePath(file)
title = open(filename).readline().rstrip("\n")
filename = filename.name
if filename[0] != ".":
filename = filename.split(".", 1)[0]
content_string += "<li>"
content_string += curr_date + " - "
content_string += title + " ["
content_string += "<a href=\"" + "/index.html#" + \
filename + "\">" + "link" + "</a> - "
content_string += "<a href=\"" + "/entry/" + \
pathlib.PurePath(file).name + "\">" + "standalone" + "</a>"
content_string += "] <br>"
content_string += "</li>\n"
content_string += "</ul>\n"
return content_string
path_ex = ENTRY_DIR
if path.exists(path_ex):
name_list = os.listdir(path_ex)
full_list = [os.path.join(path_ex, i) for i in name_list]
contents = sorted(full_list, key=os.path.getmtime)
content_string = ""
last_month = ""
for file in reversed(contents):
curr_date = datetime.fromtimestamp(os.path.getmtime(file)).strftime("%Y-%m-%d")
curr_month = datetime.fromtimestamp(os.path.getmtime(file)).strftime("%B %Y")
if curr_month != last_month:
if last_month != "":
content_string += "</ul>\n"
content_string += "<h2>" + curr_month + "</h2>\n"
content_string += "<ul>\n"
last_month = curr_month
filename = pathlib.PurePath(file)
title = open(filename).readline().rstrip("\n")
filename = filename.name
if filename[0] != ".":
filename = filename.split(".", 1)[0]
content_string += "<li>"
content_string += "<a href=\"" + "/index.html#" + \
filename + "\">" + curr_date + "</a> - "
content_string += "<a href=\"" + "/entry/" + \
pathlib.PurePath(file).name + "\"><b>" + title + "</b></a>"
content_string += "<br>"
content_string += "</li>\n"
content_string += "</ul>\n"
return content_string
def gen_index_string():
"""
"""
Create and returns a string including every file in the ENTRY_DIR as an index.
Returns:
string: html-formatted index string
"""
path_ex = ENTRY_DIR
content_string = ""
if path.exists(path_ex):
name_list = os.listdir(path_ex)
full_list = [os.path.join(path_ex, i) for i in name_list]
contents = sorted(full_list, key=os.path.getctime)
for file in reversed(contents):
filename = pathlib.PurePath(file)
purefile = filename
title = open(filename).readline().rstrip("\n")
text = open(filename).readlines()[1:]
filename = filename.name
if filename[0] != ".":
filename = filename.split(".", 1)[0]
content_string += "<div class=\"entry\">\n"
content_string += "<h2 id=\"" + filename + "\">" + title + "</h2>\n"
content_string += "[<a href=\"" + "/entry/" + \
pathlib.PurePath(file).name + "\">" + \
"standalone" + "</a>]<br>\n"
if file.endswith(".html"):
for line in text:
content_string += line
content_string += "<br>"
if file.endswith(".md"):
content_string += gen_md_content(file, 2)
content_string += "<small>" + \
datetime.fromtimestamp(os.path.getctime(
file)).strftime("%Y-%m-%d") + "</small>"
content_string += "</div>"
return content_string
path_ex = ENTRY_DIR
content_string = ""
if path.exists(path_ex):
name_list = os.listdir(path_ex)
full_list = [os.path.join(path_ex, i) for i in name_list]
contents = sorted(full_list, key=os.path.getmtime)
for file in reversed(contents):
filename = pathlib.PurePath(file)
# purefile = filename
title = open(filename).readline().rstrip("\n")
text = open(filename).readlines()[1:]
filename = filename.name
if filename[0] != ".":
filename = filename.split(".", 1)[0]
content_string += "<div class=\"entry\">\n"
content_string += "<h2 id=\"" + filename + "\">"
content_string += "<a href=\"" + "/entry/" + \
pathlib.PurePath(file).name + "\">" + \
title + "</a>" +"</h2>\n"
content_string += "<small>" + \
datetime.fromtimestamp(os.path.getmtime(
file)).strftime("%Y-%m-%d") + "</small><br><br>"
if file.endswith(".html"):
for line in text:
content_string += line
if file.endswith(".md"):
content_string += gen_md_content(file, 2)
content_string += "</div>"
return content_string
def gen_stand_string(path_ex):
"""
"""
Creates a html-string for a file.
If the file is markdown it will convert it.
This functions ensures upscaling for future formats.
@@ -102,28 +105,28 @@ def gen_stand_string(path_ex):
Returns:
string: html-formatted string string equivalent to the file
"""
filename = os.path.join(ENTRY_DIR, path_ex)
content_string = ""
if path.exists(filename):
title = open(filename).readline().rstrip("\n")
text = open(filename).readlines()[1:]
filename_no_end = filename.split(".", 1)[0]
content_string += "<h1>" + title + "</h1>\n"
content_string += "["
content_string += "<a href=\"" + "/index.html#" + \
filename_no_end + "\">" + "link" + "</a>"
content_string += "]<br>\n"
if filename.endswith(".html"):
for line in text:
content_string += line
content_string += "<br>"
if filename.endswith(".md"):
content_string += gen_md_content(filename, 1)
return content_string
filename = os.path.join(ENTRY_DIR, path_ex)
content_string = ""
if path.exists(filename):
title = open(filename).readline().rstrip("\n")
text = open(filename).readlines()[1:]
curr_date = datetime.fromtimestamp(os.path.getmtime(filename)).strftime("%Y-%m-%d")
filename_no_end = filename.split(".", 1)[0]
filename_no_end = filename_no_end.split("/")[-1]
content_string += "<h1>" + title + "</h1>\n"
content_string += "<a href=\"" + "/index.html#" + \
filename_no_end + "\">" + curr_date + "</a>"
content_string += "<br><br>\n"
if filename.endswith(".html"):
for line in text:
content_string += line
if filename.endswith(".md"):
content_string += gen_md_content(filename, 1)
return content_string
def gen_md_content(path_ex, depth):
"""
"""
Convert a markdown file to a html string.
Parameters:
@@ -133,54 +136,115 @@ def gen_md_content(path_ex, depth):
Returns:
string: html-formatted string string equivalent to the markdown file
"""
content_string = ""
if path.exists(path_ex):
filename = path_ex.split(".", 1)
fileend = filename[len(filename) - 1]
header = "#"
for i in range(depth):
header += "#"
header += " "
markdown_lines = open(path_ex, "r").readlines()[1:]
markdown_text = ""
for line in markdown_lines:
markdown_text += line.replace("# ", header)
content_string = markdown.markdown(
markdown_text, extensions=["fenced_code", "tables"]
)
return content_string
content_string = ""
if path.exists(path_ex):
filename = path_ex.split(".", 1)
fileend = filename[len(filename) - 1]
header = "#"
for i in range(depth):
header += "#"
header += " "
markdown_lines = open(path_ex, "r").readlines()[1:]
markdown_text = ""
for line in markdown_lines:
markdown_text += line.replace("# ", header)
content_string = markdown.markdown(markdown_text, extensions=["fenced_code", "tables"])
return content_string
def get_rss_string():
"""
"""
Create a rss-string of the blog and return it.
Returns:
string: rss-string of everything that is in the ENTRY_DIR.
"""
path_ex = ENTRY_DIR
if path.exists(path_ex):
name_list = os.listdir(path_ex)
full_list = [os.path.join(path_ex, i) for i in name_list]
contents = sorted(full_list, key=os.path.getctime)
content_string = ""
for file in reversed(contents):
filename = pathlib.PurePath(file)
title = open(filename).readline().rstrip("\n")
text = open(filename).readlines()[1:]
filename = filename.name
if filename[0] != ".":
filename = filename.split(".", 1)[0]
content_string += "<item>\n"
content_string += "<title>" + title + "</title>\n"
content_string += "<guid>" + config.WEBSITE + \
"/index.html#" + filename + "</guid>\n"
content_string += "<pubDate>" + \
datetime.fromtimestamp(os.path.getctime(file)).strftime(
"%Y-%m-%d") + "</pubDate>\n"
content_string += "<description>"
for line in text:
content_string += line
content_string += "</description>\n"
content_string += "</item>\n"
return content_string
path_ex = ENTRY_DIR
content_string = ""
if path.exists(path_ex):
name_list = os.listdir(path_ex)
full_list = [os.path.join(path_ex, i) for i in name_list]
contents = sorted(full_list, key=os.path.getmtime)
for file in reversed(contents):
filename = pathlib.PurePath(file)
title = open(filename).readline().rstrip("\n")
text = open(filename).readlines()[1:]
filename = filename.name
if filename[0] != ".":
filename = filename.split(".", 1)[0]
content_string += "<item>\n"
content_string += "<title>" + title + "</title>\n"
content_string += "<guid>" + config.WEBSITE + \
"/index.html#" + filename + "</guid>\n"
content_string += "<pubDate>" + \
datetime.fromtimestamp(os.path.getmtime(file)).strftime(
"%Y-%m-%d") + "</pubDate>\n"
content_string += "<description>"
for line in text:
content_string += line
content_string += "</description>\n"
content_string += "</item>\n"
return content_string
def gen_query_res_string(query_str):
"""
Return the results of a query.
Parameters:
query_str (string): term to search
Returns:
string: html-formated search result
"""
src_results = search.search(query_str)
res_string = ""
for result in src_results:
title = result["title"]
path = result["path"]
filename = pathlib.PurePath(path)
filename = filename.name
if filename[0] != ".":
filename = filename.split(".", 1)[0]
curr_date = datetime.fromtimestamp(os.path.getmtime(path)).strftime("%Y-%m-%d")
is_markdown = path.endswith(".md")
preview = create_preview(path, is_markdown)
path = "/entry/" + path.split("/", 2)[2]
res_string += "<div class=\"entry\">"
res_string += "<a href=\"" + path + "\"><h2>" + title + "</h2></a>"
res_string += "<small>"
res_string += "<a href=\"" + "/index.html#" + \
filename + "\">" + curr_date + "</a>"
res_string += "</small><br><br>"
res_string += preview + "</div>"
return res_string
def create_preview(path, is_markdown):
"""
Create a preview of a given article and return it.
Parameters:
path (string): path to the article
Returns:
string: html-formated preview
"""
file = open(path, "r", encoding="utf-8")
first_lines = file.readlines()
preview = ""
preview_length = 3
for i, line in enumerate(first_lines):
if i == 0:
continue
if i > preview_length:
break
if not line.isspace():
if is_markdown:
preview += markdown.markdown(line)
else:
preview += line
else:
preview_length += 1
preview += "<br>...<br>"
return preview

16
src/forms.py Normal file
View File

@@ -0,0 +1,16 @@
import os
from flask_wtf import CSRFProtect, FlaskForm
from wtforms import StringField, SubmitField, ValidationError, validators
def register_csrf(app):
csrf = CSRFProtect()
SECRET_KEY = os.urandom(32)
app.secret_key = SECRET_KEY
csrf.init_app(app)
class SearchForm(FlaskForm):
query_str = StringField("Query", [validators.DataRequired("Please enter the search term")])
# submit = SubmitField("Search")

View File

@@ -1,2 +1,6 @@
Flask==2.3.2
Markdown==3.1.1
Flask
Markdown
Whoosh
WTForms
Flask_WTF
Font-Awesome-Flask

72
src/search.py Normal file
View File

@@ -0,0 +1,72 @@
import os
from whoosh import scoring
from whoosh.fields import ID, TEXT, Schema
from whoosh.index import create_in, open_dir
from whoosh.qparser import QueryParser
import config
INDEX_DIR = "indexdir"
DEF_TOPN = 10
ENTRY_DIR = config.ENTRY_DIR
def createSearchableData(root):
"""
Schema definition: title(name of file), path(as ID), content(indexed but not stored), textdata (stored text content)
source:
https://appliedmachinelearning.blog/2018/07/31/developing-a-fast-indexing-and-full-text-search-engine-with-whoosh-a-pure-pythhon-library/
"""
schema = Schema(title=TEXT(stored=True), path=ID(stored=True), content=TEXT)
if not os.path.exists(INDEX_DIR):
os.mkdir(INDEX_DIR)
ix = create_in(INDEX_DIR, schema)
writer = ix.writer()
for r, _, f in os.walk(root):
for file in f:
path = os.path.join(r, file)
fp = open(path, encoding="utf-8")
title = fp.readline()
text = title + fp.read()
writer.add_document(title=title, path=path, content=text)
fp.close()
writer.commit()
def search_times(query_str, topN):
"""
Search for a given term and returns a specific amount of results.
Parameters:
query_str (string): term to search for
topN (int): number of results to return
Returns:
string: html-formatted string including the hits of the search
"""
ix = open_dir(INDEX_DIR)
results = []
with ix.searcher(weighting=scoring.BM25F) as s:
query = QueryParser("content", ix.schema).parse(query_str)
matches = s.search(query, limit=topN)
for match in matches:
results.append({"title": match["title"], "path": match["path"], "match": match.score})
return results
def search(query_str):
"""
Search for a given term and show the predefined amount of results.
Parameters:
query_str (string): term to search for
Returns:
string: html-formatted string including the hits of the search
"""
return search_times(query_str, DEF_TOPN)
createSearchableData(ENTRY_DIR)

View File

@@ -3,6 +3,7 @@
:root {
--bg0: rgb(29,32,33);
--color0: rgb(220,120,0);
--color1: rgb(280,180,0);
--error: rgb(255,0,0);
--footerbg0: rgb(29,32,33);
--link0: rgb(220, 120, 0);
@@ -51,11 +52,13 @@ span {
.hide-menu:hover,
.main-menu a:hover,
.main-menu-dropdown a:hover,
.show-menu:hover {
color: var(--menulink1);
}
.main-menu a {
.main-menu a,
.main-menu-dropdown a {
color: var(--menulink0);
}
@@ -81,3 +84,13 @@ span {
.entry h2 {
color: var(--text1);
}
form.search button[type=submit] {
background: var(--color0);
color: var(--bg0);
}
form.search button[type=submit]:hover {
background: var(--color1);
}

View File

@@ -3,10 +3,11 @@
:root {
--bg0: rgb(255,255,255);
--color0: rgb(0,0,120);
--color1: rgb(0,0,200);
--error: rgb(255,0,0);
--footerbg0: rgb(192,192,192);
--link0: rgb(0,0,120);
--link1: rgb(255,255,255);
--link1: rgb(192,192,192);
--menulink0: rgb(0,0,120);
--menulink1: rgb(255,255,255);
--menubg0: rgb(192,192,192);
@@ -32,6 +33,14 @@ footer {
color: var(--text0);
}
footer a {
color: var(--menulink0);
}
footer a:hover {
color: var(--bg0);
}
span {
color: var(--text1);
}
@@ -51,11 +60,13 @@ span {
.hide-menu:hover,
.main-menu a:hover,
.main-menu-dropdown a:hover,
.show-menu:hover {
color: var(--menulink1);
}
.main-menu a {
.main-menu a,
.main-menu-dropdown a {
color: var(--menulink0);
}
@@ -81,3 +92,12 @@ span {
.entry h2 {
color: var(--text1);
}
form.search button[type=submit] {
background: var(--color0);
color: var(--bg0);
}
form.search button[type=submit]:hover {
background: var(--color1);
}

View File

@@ -76,9 +76,14 @@ footer .center {
padding-top: 10px;
}
.main-menu-dropdown span {
.main-menu-dropdown img {
float: left;
font-family: monospace;
}
.main-menu-dropdown span,
.main-menu-dropdown a {
float: left;
font-family: Georgia, serif;
font-size: 30px;
font-weight: bold;
line-height: 100px;
@@ -90,7 +95,7 @@ footer .center {
.main-menu {
float: right;
font-family: monospace;
font-family: Georgia, serif;
font-size: 30px;
font-weight: bold;
line-height: 100px;
@@ -152,18 +157,104 @@ footer .center {
}
}
form {
margin-bottom: 40px;
}
.entry {
border-radius: 0 10px 30px 0;
margin-bottom: 20px;
padding: 10px;
padding-left: 20px;
}
.entry h1,
.entry h2 {
margin: 5px auto 2px auto;
h1, h2 {
padding-top: 20px;
padding-bottom: 20px;
}
h3 {
padding-top: 10px;
padding-bottom: 10px;
}
.standalone h1:first-child {
padding-bottom: 0;
}
.imprint h1:first-child {
padding-bottom: 20px;
}
.blog h1:first-child {
padding-bottom: 20px;
}
.entry h2:first-child {
padding-top: 0;
padding-bottom: 0;
}
.blogarchive h1:first-child {
padding-bottom: 0;
}
.blogarchive h2:first-child {
padding-top: 0;
padding-bottom: 0;
}
.entry ul {
padding-left: 20;
}
figure {
padding-top: 20px;
padding-bottom: 20px;
}
.entry figure:last-child {
padding-bottom:0
}
ul {
padding-left:20px;
}
ol {
padding-left:20px;
}
code {
border-radius: 25px;
padding-left: 20px;
padding-right: 20px;
page-break-inside: avoid;
font-family: monospace;
white-space: pre;
display: inline-block
}
form.search input[type=text] {
padding: 10px;
font-size: 17px;
border: 1px solid grey;
float: left;
width: 50%;
background: #f1f1f1;
}
form.search button[type=submit] {
float: left;
width: 5%;
padding: 12px;
font-size: 17px;
border: 1px solid grey;
border-left: none; /* Prevent double borders */
cursor: pointer;
}
form.search::after {
content: "";
clear: both;
display: table;
}

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -1,11 +1,11 @@
{% extends "template.html" %}
{% block content %}
<div class="container">
<div class="blogarchive">
<h1>Archive</h1><br>
{% autoescape off %}
{{ content_string }}
{% endautoescape %}
</div>
<div class="blogarchive">
<h1>{% if language=="de-de" %}Archiv{% else %}Archive{% endif %}</h1><br>
{% autoescape off %}
{{ content_string }}
{% endautoescape %}
</div>
</div>
{% endblock %}

View File

@@ -1,9 +1,9 @@
{% extends "template.html" %}
{% block content %}
<div class="container">
<div class="important">
Error<br>
<span>{{ errorcode }}</span>
</div>
<div class="important">
{% if language=="de-de" %}Fehler{% else %}Error{% endif %}<br>
<span>{{ errorcode }}</span>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,91 @@
{% extends "template.html" %}
{% block content %}
<div class="container">
<div class="imprint">
<h1>{% if language=="de-de" %}Impressum{% else %}Imprint{% endif %}</h1><br>
{% if language=="de-de" %}
<h2>Kontakt:</h2>
<ul>
<li><a href='mailto:{{ mail }}'>E-Mail</a></li>
</ul>
<h2>Haftungsausschluss:</h2>
<h3>Haftung für Inhalte</h3>
<p>
Die Inhalte unserer Seiten wurden mit größter Sorgfalt erstellt. Für die Richtigkeit, Vollständigkeit und
Aktualität der Inhalte können wir jedoch keine Gewähr übernehmen. Als Diensteanbieter sind wir gemäß § 7 Abs.1
TMG für eigene Inhalte auf diesen Seiten nach den allgemeinen Gesetzen verantwortlich. Nach §§ 8 bis 10 TMG sind
wir als Diensteanbieter jedoch nicht verpflichtet, übermittelte oder gespeicherte fremde Informationen zu
überwachen oder nach Umständen zu forschen, die auf eine rechtswidrige Tätigkeit hinweisen. Verpflichtungen zur
Entfernung oder Sperrung der Nutzung von Informationen nach den allgemeinen Gesetzen bleiben hiervon unberührt.
Eine diesbezügliche Haftung ist jedoch erst ab dem Zeitpunkt der Kenntnis einer konkreten Rechtsverletzung
möglich. Bei Bekanntwerden von entsprechenden Rechtsverletzungen werden wir diese Inhalte umgehend
entfernen.
</p>
<h3>Haftung für Links</h3>
<p>
Unser Angebot enthält Links zu externen Webseiten Dritter, auf deren Inhalte wir keinen Einfluss haben. Deshalb
können wir für diese fremden Inhalte auch keine Gewähr übernehmen. Für die Inhalte der verlinkten Seiten ist
stets der jeweilige Anbieter oder Betreiber der Seiten verantwortlich. Die verlinkten Seiten wurden zum
Zeitpunkt der Verlinkung auf mögliche Rechtsverstöße überprüft. Rechtswidrige Inhalte waren zum Zeitpunkt der
Verlinkung nicht erkennbar. Eine permanente inhaltliche Kontrolle der verlinkten Seiten ist jedoch ohne konkrete
Anhaltspunkte einer Rechtsverletzung nicht zumutbar. Bei Bekanntwerden von Rechtsverletzungen werden wir
derartige Links umgehend entfernen.
</p>
<h3>Urheberrecht</h3>
<p>
Die durch die Seitenbetreiber erstellten Inhalte und Werke auf diesen Seiten unterliegen dem deutschen
Urheberrecht. Die Vervielfältigung, Bearbeitung, Verbreitung und jede Art der Verwertung außerhalb der Grenzen
des Urheberrechtes bedürfen der schriftlichen Zustimmung des jeweiligen Autors bzw. Erstellers. Downloads und
Kopien dieser Seite sind nur für den privaten, nicht kommerziellen Gebrauch gestattet. Soweit die Inhalte auf
dieser Seite nicht vom Betreiber erstellt wurden, werden die Urheberrechte Dritter beachtet. Insbesondere werden
Inhalte Dritter als solche gekennzeichnet. Sollten Sie trotzdem auf eine Urheberrechtsverletzung aufmerksam
werden, bitten wir um einen entsprechenden Hinweis. Bei Bekanntwerden von Rechtsverletzungen werden wir
derartige Inhalte umgehend entfernen.
</p>
{% else %}
<h2>Contact:</h2>
<p><a href='mailto:{{ mail }}'>E-Mail</a></p>
<h2>Disclaimer:</h2>
<h3>Liability for Content</h3>
<p>
The contents of our website have been created with the greatest possible care. However, we cannot guarantee the
contents' accuracy, completeness, or topicality. According to Section 7, paragraph 1 of the TMG (Telemediengesetz
-
German Telemedia Act), we as service providers are liable for our content on these pages by general laws. However,
according to Sections 8 to 10 of the TMG, we service providers are not obliged to monitor external information
transmitted or stored or investigate circumstances pointing to illegal activity. Obligations to remove or block
the
use of information under general laws remain unaffected. However, a liability in this regard is only possible from
the moment of knowledge of a specific infringement. Upon notification of such violations, we will remove the
content
immediately.
</p>
<h3>Liability for Links</h3>
<p>
Our website contains links to external websites, over whose contents we have no control. Therefore, we cannot
accept
any liability for these external contents. The respective provider or operator of the websites is always
responsible
for the contents of the linked pages. The linked pages were checked for possible legal violations at the time of
linking. Illegal contents were not identified at the time of linking. However, permanent monitoring of the
contents
of the linked pages is not reasonable without specific indications of a violation. Upon notification of
violations,
we will remove such links immediately.
</p>
<h3>Copyright</h3>
<p>
The contents and works on these pages created by the site operator are subject to German copyright law. The
duplication, processing, distribution, and any kind of utilization outside the limits of copyright require the
written consent of the respective author or creator. Downloads and copies of these pages are only permitted for
private, non-commercial use. In so far as the contents on this site were not created by the operator, the
copyrights
of third parties are respected. In particular, third-party content is marked as such. Should you become aware of a
copyright infringement, please inform us accordingly. Upon notification of violations, we will remove such
contents
immediately.
</p>
{% endif %}
</div>
</div>
{% endblock %}

View File

@@ -1,11 +1,11 @@
{% extends "template.html" %}
{% block content %}
<div class="container">
<div class="blog">
<h1>Index</h1><br>
{% autoescape off %}
{{ content_string }}
{% endautoescape %}
</div>
<div class="blog">
<h1>Feed</h1><br>
{% autoescape off %}
{{ content_string }}
{% endautoescape %}
</div>
</div>
{% endblock %}

View File

@@ -4,7 +4,7 @@
<channel>
<title>{{ title }}</title>
<description>{{ description }}</description>
<language>en-us</language>
<language>{{ language }}</language>
<link>{{ website }}/feed.xml</link>
<atom:link href="/feed.xml" rel="self" type="application/rss+xml" />

19
src/templates/search.html Normal file
View File

@@ -0,0 +1,19 @@
{% extends "template.html" %}
{% block content %}
<div class="container">
<div class="search">
<h1>{% if language=="de-de" %}Suche{% else %}Search{% endif %}</h1><br>
<form class="search" action="{{ url_for('search') }}" method=post>
{{ form.hidden_tag() }}
{{ form.query_str }}
<!-- {{ form.submit }} -->
<button id="submit" name="submit" type="submit" value="Search">{{ font_awesome.render_icon("fas fa-search")
}}</button>
</form>
{% autoescape off %}
{{ content }}
{% endautoescape %}
</div>
</div>
{% endblock %}

View File

@@ -1,10 +1,10 @@
{% extends "template.html" %}
{% block content %}
<div class="container">
<div class="standalone">
{% autoescape off %}
{{ content_string }}
{% endautoescape %}
</div>
<div class="standalone">
{% autoescape off %}
{{ content_string }}
{% endautoescape %}
</div>
</div>
{% endblock %}

View File

@@ -1,32 +1,43 @@
<html>
<head>
<title>{{ title }}</title>
<link href="{{ url_for('static', filename='css/' + style + '.css') }}" rel="stylesheet" type="text/css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width" initial-scale=1.0>
<title>{{ title }}</title>
<link href="{{ url_for('static', filename='css/' + style + '.css') }}" rel="stylesheet" type="text/css">
<link rel="icon" type="image/x-icon" href="{{ url_for('static', filename='graphics/logo.png') }}">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width" initial-scale=1.0>
{{ font_awesome.load_js() }}
</head>
<body>
<!-- Menu -->
<div class="main-menu-dropdown">
<!-- <img class="logo" src="/static/images/logo.png"> -->
<span>{{ title }}</span>
<input type="checkbox" id="main-menu-check">
<label for="main-menu-check" class="show-menu">&#9776;</label>
<div class="main-menu">
<a href="{{ url_for('index') }}">Blog</a>
<a href="{{ url_for('archive') }}">Archive</a>
<label for="main-menu-check" class="hide-menu">X</label>
</div>
<!-- Menu -->
<div class="main-menu-dropdown">
<a href="{{ url_for('index') }}">
<img class="logo" src="{{ url_for('static', filename='graphics/logo.png') }}">
{{ stitle }}
</a>
<input type="checkbox" id="main-menu-check">
<label for="main-menu-check" class="show-menu">&#9776;</label>
<div class="main-menu">
<a href="{{ url_for('index') }}">Blog</a>
<a href="{{ url_for('archive') }}">{% if language=="de-de" %}Archiv{% else %}Archive{% endif %}</a>
<a href="{{ url_for('search') }}">{% if language=="de-de" %}Suche{% else %}Search{% endif %}</a>
<label for="main-menu-check" class="hide-menu">X</label>
</div>
<!-- Menu -->
<!-- Content -->
{% block content %}
{% endblock %}
<!-- Content -->
<footer>
<div class="center">
Made with <a href="https://github.com/tiyn/beaker-blog">Beaker Blog </a>.
</div>
</footer>
</div>
<!-- Menu -->
<!-- Content -->
{% block content %}
{% endblock %}
<!-- Content -->
<footer>
<div class="center">
<a href="{{ url_for('imprint') }}">
{% if language=="de-de" %}Impressum und Kontakt{% else %}Imprint and Contact{% endif %}
</a><br>
Made with <a href="https://github.com/tiyn/beaker-blog">Beaker Blog</a>.
</div>
</footer>
</body>
</html>