Skip to content

Commit

Permalink
Make a template for the about page
Browse files Browse the repository at this point in the history
  • Loading branch information
tucked committed Jan 18, 2025
1 parent 2c7cb72 commit 7f99eaf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
16 changes: 16 additions & 0 deletions pbnh/templates/about.html.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<html>
<head>
<title>pbnh</title>
<script src="{{ url_for('static', filename='marked.min.js') }}"></script>
<script src="{{ url_for('static', filename='purify.min.js') }}"></script>
</head>
<body>
<div id="content"></div>
<script>
const xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "{{ url_for('static', filename='about.md') }}", false);
xmlhttp.send();
document.getElementById("content").innerHTML = DOMPurify.sanitize(marked.parse(xmlhttp.responseText.replace(/pbnh.example.com/g, "{{ host }}")));
</script>
</body>
</html>
5 changes: 1 addition & 4 deletions pbnh/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from flask import (
abort,
Blueprint,
current_app,
redirect,
render_template,
request,
Expand Down Expand Up @@ -227,9 +226,7 @@ def about() -> flask.typing.ResponseReturnValue:
if str(request.url_rule) == "/about.md":
# /about used to be /about.md:
return redirect("/about", 301)
return render_template(
"markdown.html.jinja", url=f"{current_app.static_url_path}/about.md"
)
return render_template("about.html.jinja", host=request.host)


@blueprint.get("/<string:hashid>/")
Expand Down

0 comments on commit 7f99eaf

Please sign in to comment.