mirror of
https://git.ari.lt/ari.lt/blog.ari.lt.git
synced 2025-02-04 09:39:25 +01:00
update @ Wed 15 Jun 00:44:21 EEST 2022
Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
parent
e659230303
commit
c5f013d58d
2 changed files with 48 additions and 35 deletions
|
@ -50,6 +50,8 @@
|
||||||
],
|
],
|
||||||
"theme-colour": "#f9f6e8",
|
"theme-colour": "#f9f6e8",
|
||||||
"background-colour": "#262220",
|
"background-colour": "#262220",
|
||||||
|
"full-name": "Ari Archer",
|
||||||
|
"locale": "en_GB",
|
||||||
"blogs": {
|
"blogs": {
|
||||||
"new-blog-management-system-": {
|
"new-blog-management-system-": {
|
||||||
"title": "TmV3IGJsb2cgbWFuYWdlbWVudCBzeXN0ZW0h",
|
"title": "TmV3IGJsb2cgbWFuYWdlbWVudCBzeXN0ZW0h",
|
||||||
|
|
81
scripts/blog
81
scripts/blog
|
@ -59,6 +59,8 @@ DEFAULT_CONFIG: Dict = {
|
||||||
"meta-icons": [{"src": "/favicon.ico", "sizes": "128x128", "type": "image/png"}],
|
"meta-icons": [{"src": "/favicon.ico", "sizes": "128x128", "type": "image/png"}],
|
||||||
"theme-colour": "#f9f6e8",
|
"theme-colour": "#f9f6e8",
|
||||||
"background-colour": "#262220",
|
"background-colour": "#262220",
|
||||||
|
"full-name": "Ari Archer",
|
||||||
|
"locale": "en_GB",
|
||||||
"blogs": {},
|
"blogs": {},
|
||||||
}
|
}
|
||||||
DEFAULT_CONFIG_FILE: str = "blog.json"
|
DEFAULT_CONFIG_FILE: str = "blog.json"
|
||||||
|
@ -67,52 +69,57 @@ BLOG_VERSION: int = 1
|
||||||
|
|
||||||
BLOG_MARKDOWN_TEMPLATE: str = """# %s
|
BLOG_MARKDOWN_TEMPLATE: str = """# %s
|
||||||
|
|
||||||
<nav id="info-bar" aria-hidden="true">
|
<header>
|
||||||
<time>%s</time> GMT | <a href="%s">back</a> | <a href="/">home</a> | <a href="%s">git</a>
|
<nav id="info-bar" aria-hidden="true">
|
||||||
</nav>
|
<time>%s</time> GMT | <a href="%s">back</a> | <a href="/">home</a> \
|
||||||
|
| <a href="%s">git</a>
|
||||||
|
<hr/>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
<hr/>
|
|
||||||
|
|
||||||
<article id="blog-content">
|
|
||||||
<main>
|
<main>
|
||||||
|
|
||||||
%s
|
%s
|
||||||
|
|
||||||
</main>
|
</main>"""
|
||||||
</article>"""
|
|
||||||
|
|
||||||
HTML_HEADER: str = """<head>
|
HTML_HEADER: str = f"""<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8"/>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
<title>{title}</title>
|
<title>{{title}}</title>
|
||||||
|
|
||||||
<meta property="og:type" content="website">
|
<meta property="og:locale" content="{{locale}}"/>
|
||||||
|
|
||||||
<meta name="color-scheme" content="{theme_type}">
|
<meta name="color-scheme" content="{{theme_type}}"/>
|
||||||
|
<meta name="author" content="{{author}}"/>
|
||||||
<meta name="keywords" content="{keywords}">
|
<meta name="keywords" content="{{keywords}}"/>
|
||||||
<meta name="robots" content="follow"/>
|
<meta name="robots" content="follow"/>
|
||||||
|
<meta name="generator" \
|
||||||
|
content="Ari-web blog generator version {BLOG_VERSION}"/>
|
||||||
|
<meta name="color-scheme" content="{{title}}"/>
|
||||||
|
|
||||||
<link rel="stylesheet" href="/content/styles.min.css"/>"""
|
<link rel="stylesheet" href="/content/styles.min.css"/>"""
|
||||||
|
|
||||||
BLOG_HTML_TEMPLATE: str = f"""<!DOCTYPE html>
|
BLOG_HTML_TEMPLATE: str = f"""<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
{HTML_HEADER}
|
{HTML_HEADER}
|
||||||
<meta name="description" content="{{blog_description}}">
|
<meta name="description" content="{{blog_description}}"/>
|
||||||
|
<meta property="og:type" content="article"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>
|
<article id="blog-content">
|
||||||
{{blog}}
|
{{blog}}
|
||||||
</div>
|
</article>
|
||||||
</body>
|
</body>
|
||||||
</html>"""
|
</html>"""
|
||||||
|
|
||||||
HOME_PAGE_HTML_TEMPLATE: str = f"""<!DOCTYPE html>
|
HOME_PAGE_HTML_TEMPLATE: str = f"""<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
{HTML_HEADER}
|
{HTML_HEADER}
|
||||||
<meta name="description" content="{{home_page_description}}" />
|
<meta name="description" content="{{home_page_description}}"/>
|
||||||
<link rel="manifest" href="/manifest.json" />
|
<meta property="og:type" content="website"/>
|
||||||
|
<link rel="manifest" href="/manifest.json"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>My blogs</h1>
|
<h1>My blogs</h1>
|
||||||
|
@ -123,7 +130,7 @@ latest blog: <a href="{{latest_blog_url}}">{{latest_blog_title}}</a> | \
|
||||||
<hr/>
|
<hr/>
|
||||||
</nav>
|
</nav>
|
||||||
<main>
|
<main>
|
||||||
{{content}}
|
{{content}}
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
</html>"""
|
</html>"""
|
||||||
|
@ -294,7 +301,8 @@ def build(config: Dict) -> Tuple[int, Dict]:
|
||||||
def thread(blog_id: str, blog_meta: Dict):
|
def thread(blog_id: str, blog_meta: Dict):
|
||||||
if blog_meta["version"] != BLOG_VERSION:
|
if blog_meta["version"] != BLOG_VERSION:
|
||||||
log(
|
log(
|
||||||
f"{blog_id}: unmatching version between {blog_meta['version']} and {BLOG_VERSION}",
|
f"{blog_id}: unmatching version between \
|
||||||
|
{blog_meta['version']} and {BLOG_VERSION}",
|
||||||
"WARNING",
|
"WARNING",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -323,11 +331,12 @@ def build(config: Dict) -> Tuple[int, Dict]:
|
||||||
blog_html_full: str = BLOG_HTML_TEMPLATE.format(
|
blog_html_full: str = BLOG_HTML_TEMPLATE.format(
|
||||||
title=config["page-title"],
|
title=config["page-title"],
|
||||||
theme_type=config["colourscheme-type"],
|
theme_type=config["colourscheme-type"],
|
||||||
keywords=blog_meta["keywords"]
|
keywords=blog_meta["keywords"].replace(" ", ", ")
|
||||||
+ " "
|
+ ", ".join(config["default-keywords"]),
|
||||||
+ " ".join(config["default-keywords"]),
|
|
||||||
blog_description=f"Blog on {blog_time} GMT -- {blog_title}",
|
blog_description=f"Blog on {blog_time} GMT -- {blog_title}",
|
||||||
blog=blog_base_html,
|
blog=blog_base_html,
|
||||||
|
author=config["full-name"],
|
||||||
|
locale=config["locale"],
|
||||||
)
|
)
|
||||||
|
|
||||||
if blog_meta["minimise"]:
|
if blog_meta["minimise"]:
|
||||||
|
@ -381,7 +390,7 @@ def build(config: Dict) -> Tuple[int, Dict]:
|
||||||
HOME_PAGE_HTML_TEMPLATE.format(
|
HOME_PAGE_HTML_TEMPLATE.format(
|
||||||
title=config["page-title"],
|
title=config["page-title"],
|
||||||
theme_type=config["colourscheme-type"],
|
theme_type=config["colourscheme-type"],
|
||||||
keywords=config["home-keywords"],
|
keywords=", ".join(config["home-keywords"]),
|
||||||
home_page_description=config["page-description"],
|
home_page_description=config["page-description"],
|
||||||
lastest_blog_time=lastest_blog_time,
|
lastest_blog_time=lastest_blog_time,
|
||||||
latest_blog_url=os.path.join(config["blog-dir"], latest_blog_id),
|
latest_blog_url=os.path.join(config["blog-dir"], latest_blog_id),
|
||||||
|
@ -391,6 +400,8 @@ def build(config: Dict) -> Tuple[int, Dict]:
|
||||||
+ "...",
|
+ "...",
|
||||||
git_url=config["git-url"],
|
git_url=config["git-url"],
|
||||||
content=blog_list,
|
content=blog_list,
|
||||||
|
author=config["full-name"],
|
||||||
|
locale=config["locale"],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -407,12 +418,12 @@ def list_blogs(config: Dict) -> Tuple[int, Dict]:
|
||||||
for blog_id, blog_meta in config["blogs"].items():
|
for blog_id, blog_meta in config["blogs"].items():
|
||||||
print(
|
print(
|
||||||
f"""ID: {blog_id}
|
f"""ID: {blog_id}
|
||||||
Title: {b64decode(blog_meta['title']).decode()!r}
|
Title: {b64decode(blog_meta["title"]).decode()!r}
|
||||||
Version: {blog_meta['version']}
|
Version: {blog_meta["version"]}
|
||||||
Time_of_creation: {format_time(blog_meta['time'])}
|
Time_of_creation: {format_time(blog_meta["time"])}
|
||||||
Keywords: {blog_meta['keywords'].replace(' ', ', ')}
|
Keywords: {blog_meta['keywords'].replace(" ", ", ")}
|
||||||
Minimise: {yesno(blog_meta['minimise'])}
|
Minimise: {yesno(blog_meta["minimise"])}
|
||||||
Hidden: {yesno(blog_meta['hidden'])}
|
Hidden: {yesno(blog_meta["hidden"])}
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue