Adjust for frozen-flask

Changes:
========
* adjust URL convention to include '.html' (except on index)
* rename 'templates/blog' directory to less ambiguous 'templates/posts'
main
Marie-Joseph 2 years ago
parent daf1c756c5
commit fd75dacebe

@ -30,7 +30,7 @@ This is the main Flask application for https://tree.st
"""
(render-template "index.html")))
#@((.route app "/blog" :methods ["GET" "POST"])
#@((.route app "/blog.html" :methods ["GET" "POST"])
#@((.route app "/blog/<string:post_name>")
(defn blog [[post-name None]]
"""

@ -8,7 +8,7 @@ Blog helper functions
;; These are global variables because they are useful
;; throughout the file. They should be considered private.
(setv _posts-prefix "templates/")
(setv _posts-dir "blog/")
(setv _posts-dir "posts/")
(setv _posts-suffix ".html")
(defn test-retrieve-posts [^str post-name]
@ -31,7 +31,7 @@ Blog helper functions
(lfor post (listdir (+ _posts-prefix _posts-dir))
:if (.endswith post _posts-suffix)
(+ _posts-dir post))
[(+ _posts-dir post-name _posts-suffix)]))
[(+ _posts-dir post-name)]))
(defn post-exists? [^str post-name]
"""
@ -40,5 +40,4 @@ Blog helper functions
"""
(exists (+ _posts-prefix
_posts-dir
post-name
_posts-suffix)))
post-name)))

@ -0,0 +1,9 @@
"""
A script whose execution freezes the website into a static format
"""
(import [flask-frozen [Freezer]])
(import [app [app]])
(if (= __name__ "__main__")
(.freeze (Freezer app)))

@ -1,12 +1,16 @@
/* General styling */
:root {
--text-color: #ffffea;
}
* {
box-sizing: border-box;
}
html {
font-family: sans-serif;
background-color: tan;
font-family: sans-serif;
}
body {
@ -30,36 +34,37 @@ nav {
}
.nav-item {
padding: .25rem;
color: black;
padding: .25rem;
}
/* Content styling */
main {
width: 75%;
max-width: 50rem;
background-color: brown;
margin: 0 auto 0 auto;
max-width: 50rem;
padding: 3rem;
text-align: center;
background-color: brown;
width: 75%;
}
footer {
text-align: center;
margin-top: 3rem;
text-align: center;
}
/* Blog styling */
.blog-post {
text-align: left;
color: var(--text-color);
border-bottom: dotted;
padding: 0rem 0rem 2.5rem 1rem;
text-align: left;
}
.blog-title a {
color: black;
.blog-post a {
color: var(--text-color);
}
.blog-show-more {

@ -1,8 +1,8 @@
<h2 class="blog-title">
<a href="{{ url_for('blog', post_name=self.date()) }}">
<a href="{{ url_for('blog', post_name=self.date()+'.html') }}" tabindex="0">
{% block title %}{% endblock %}
</a>
</h2>
<h4 class="blog-date">{% block date %}{% endblock %}</h4>
<summary class="blog-summary"><p>{% block summary %}{% endblock %}</p></summary>
<summary class="blog-summary" tabindex="0"><p>{% block summary %}{% endblock %}</p></summary>
<details class="blog-content">{% block content %}{% endblock %}</details>

@ -8,7 +8,7 @@
<link href="{{ url_for('static', filename='favicon.ico') }}" rel="shortcut icon">
<title>Trees' Street</title>
</head>
<body>
<body tabindex="0">
<header>
<h1>You find yourself on a winding path deep in the forest...</h1>
<nav>