mirror of
https://git.ari.lt/ari.lt/blog.ari.lt.git
synced 2025-02-04 17:49:24 +01:00
update @ Thu Oct 26 18:03:32 EEST 2023
Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
parent
d058131734
commit
0fba670424
3 changed files with 37 additions and 3 deletions
|
@ -63,6 +63,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"author": "Ari Archer",
|
"author": "Ari Archer",
|
||||||
|
"email": "ari.web.xyz@gmail.com",
|
||||||
"locale": "en_GB",
|
"locale": "en_GB",
|
||||||
"recents": 14,
|
"recents": 14,
|
||||||
"indent": 2,
|
"indent": 2,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
:root {
|
:root {
|
||||||
--bq-b: #ede9d3;
|
--bq-b: #ede9d3;
|
||||||
|
|
||||||
--bqw: 2px;
|
--bqw: 2px;
|
||||||
|
|
||||||
--a-f: #cdc4c4; /* #9e9b9b; */
|
--a-f: #cdc4c4; /* #9e9b9b; */
|
||||||
|
@ -76,3 +77,19 @@ time {
|
||||||
br {
|
br {
|
||||||
margin-bottom: 0.2em;
|
margin-bottom: 0.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
height: 98vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
text-align: center;
|
||||||
|
filter: brightness(75%);
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex-grow: 2;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import web_mini
|
||||||
from readtime import of_markdown as read_time_of_markdown # type: ignore
|
from readtime import of_markdown as read_time_of_markdown # type: ignore
|
||||||
|
|
||||||
__version__: typing.Final[int] = 2
|
__version__: typing.Final[int] = 2
|
||||||
|
GEN: typing.Final[str] = f"ari-web blog generator version {__version__}"
|
||||||
|
|
||||||
|
|
||||||
OK: typing.Final[int] = 0
|
OK: typing.Final[int] = 0
|
||||||
|
@ -78,6 +79,7 @@ DEFAULT_CONFIG: dict[str, typing.Any] = {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"author": "John Doe",
|
"author": "John Doe",
|
||||||
|
"email": "me@example.com",
|
||||||
"locale": "en_GB",
|
"locale": "en_GB",
|
||||||
"recents": 14,
|
"recents": 14,
|
||||||
"indent": 4,
|
"indent": 4,
|
||||||
|
@ -197,7 +199,7 @@ html{{background-color:var(--b);color:var(--f)}}{critical_css}
|
||||||
type="application/rss+xml"
|
type="application/rss+xml"
|
||||||
/>
|
/>
|
||||||
<meta name="author" content="{author}" />
|
<meta name="author" content="{author}" />
|
||||||
<meta name="generator" content="ari-web blog generator version {version}" />
|
<meta name="generator" content="{gen}" />
|
||||||
<meta property="og:locale" content="{locale}" />
|
<meta property="og:locale" content="{locale}" />
|
||||||
<meta name="license" content="{license}">
|
<meta name="license" content="{license}">
|
||||||
<link rel="sitemap" href="/sitemap.xml" type="application/xml">"""
|
<link rel="sitemap" href="/sitemap.xml" type="application/xml">"""
|
||||||
|
@ -252,6 +254,7 @@ POST_TEMPLATE: typing.Final[str] = (
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
<article id="main">{post_content}</article>
|
<article id="main">{post_content}</article>
|
||||||
|
<footer><p>{author} <<a href="mailto:{email}">{email}</a>> + {license}</p></footer>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
</html>"""
|
</html>"""
|
||||||
|
@ -299,6 +302,7 @@ INDEX_TEMPLATE: typing.Final[str] = (
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
<article id="main"><ol reversed>{blog_list}</ol></article>
|
<article id="main"><ol reversed>{blog_list}</ol></article>
|
||||||
|
<footer><p>{author} <<a href="mailto:{email}">{email}</a>> + {license}</p></footer>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
</html>"""
|
</html>"""
|
||||||
|
@ -787,11 +791,11 @@ def build(config: dict[str, typing.Any]) -> int:
|
||||||
styles=styles,
|
styles=styles,
|
||||||
critical_css=crit_css,
|
critical_css=crit_css,
|
||||||
post_critical_css=post_crit_css,
|
post_critical_css=post_crit_css,
|
||||||
|
gen=GEN,
|
||||||
rss=config["rss-file"],
|
rss=config["rss-file"],
|
||||||
blog_title=blog_title,
|
blog_title=blog_title,
|
||||||
post_title=html_escape(post["title"]),
|
post_title=html_escape(post["title"]),
|
||||||
author=author,
|
author=author,
|
||||||
version=__version__,
|
|
||||||
locale=config["locale"],
|
locale=config["locale"],
|
||||||
post_creation_time=rformat_time(post["created"]),
|
post_creation_time=rformat_time(post["created"]),
|
||||||
post_description=html_escape(post["description"]),
|
post_description=html_escape(post["description"]),
|
||||||
|
@ -814,6 +818,7 @@ def build(config: dict[str, typing.Any]) -> int:
|
||||||
blog=config["blog"],
|
blog=config["blog"],
|
||||||
path=f"{config['posts-dir']}/{slug}",
|
path=f"{config['posts-dir']}/{slug}",
|
||||||
license=config["license"],
|
license=config["license"],
|
||||||
|
email=config["email"],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -841,10 +846,10 @@ def build(config: dict[str, typing.Any]) -> int:
|
||||||
path="",
|
path="",
|
||||||
styles=styles,
|
styles=styles,
|
||||||
critical_css=crit_css,
|
critical_css=crit_css,
|
||||||
|
gen=GEN,
|
||||||
rss=config["rss-file"],
|
rss=config["rss-file"],
|
||||||
blog_title=blog_title,
|
blog_title=blog_title,
|
||||||
author=author,
|
author=author,
|
||||||
version=__version__,
|
|
||||||
locale=config["locale"],
|
locale=config["locale"],
|
||||||
license=config["license"],
|
license=config["license"],
|
||||||
blog_description=html_escape(config["description"]),
|
blog_description=html_escape(config["description"]),
|
||||||
|
@ -862,6 +867,7 @@ def build(config: dict[str, typing.Any]) -> int:
|
||||||
f'<li><a href="/{config["posts-dir"]}/{slug}">{html_escape(post["title"])}</a></li>'
|
f'<li><a href="/{config["posts-dir"]}/{slug}">{html_escape(post["title"])}</a></li>'
|
||||||
for slug, post in config["posts"].items()
|
for slug, post in config["posts"].items()
|
||||||
),
|
),
|
||||||
|
email=config["email"],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -1009,6 +1015,10 @@ def rss(config: dict[str, typing.Any]) -> int:
|
||||||
etree.SubElement(channel, "title").text = config["title"]
|
etree.SubElement(channel, "title").text = config["title"]
|
||||||
etree.SubElement(channel, "link").text = config["blog"]
|
etree.SubElement(channel, "link").text = config["blog"]
|
||||||
etree.SubElement(channel, "description").text = config["description"]
|
etree.SubElement(channel, "description").text = config["description"]
|
||||||
|
etree.SubElement(channel, "generator").text = GEN
|
||||||
|
etree.SubElement(
|
||||||
|
channel, "webmaster"
|
||||||
|
).text = f"{config['author']} [{config['email']}]"
|
||||||
etree.SubElement(channel, "language").text = (
|
etree.SubElement(channel, "language").text = (
|
||||||
config["locale"].lower().replace("_", "-")
|
config["locale"].lower().replace("_", "-")
|
||||||
)
|
)
|
||||||
|
@ -1150,10 +1160,16 @@ def serve(config: dict[str, typing.Any]) -> int:
|
||||||
try:
|
try:
|
||||||
with open(file_path, "rb") as fp: # type: ignore
|
with open(file_path, "rb") as fp: # type: ignore
|
||||||
self.send_response(200) # type: ignore
|
self.send_response(200) # type: ignore
|
||||||
|
self.send_header(
|
||||||
|
"Cache-Control", "no-store, no-cache, must-revalidate"
|
||||||
|
)
|
||||||
|
self.send_header("Pragma", "no-cache")
|
||||||
self.end_headers() # type: ignore
|
self.end_headers() # type: ignore
|
||||||
self.wfile.write(fp.read()) # type: ignore
|
self.wfile.write(fp.read()) # type: ignore
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.send_response(404) # type: ignore
|
self.send_response(404) # type: ignore
|
||||||
|
self.send_header("Cache-Control", "no-store, no-cache, must-revalidate")
|
||||||
|
self.send_header("Pragma", "no-cache")
|
||||||
self.end_headers() # type: ignore
|
self.end_headers() # type: ignore
|
||||||
self.wfile.write(f"{e.__class__.__name__} : {e}".encode()) # type: ignore
|
self.wfile.write(f"{e.__class__.__name__} : {e}".encode()) # type: ignore
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue