chore: Update index preview when update an article

Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
Awiteb 2024-08-26 03:32:12 +00:00
parent d66ceff2be
commit 22e279e2bc
Signed by: awiteb
GPG key ID: 3F6B55640AA6682F

View file

@ -128,6 +128,7 @@ def update_header(
header_value = f'"{header_value}"' header_value = f'"{header_value}"'
article.headers[header_scope][header_name] = header_value article.headers[header_scope][header_name] = header_value
article.export() article.export()
os.system("shot-scraper --silent 'http://127.0.0.1:1111/' -w 700 -h 400 --retina --quality 60 -o static/img/social_cards/index.jpg")
print("The header has been updated successfully.") print("The header has been updated successfully.")
@ -136,8 +137,8 @@ def create_new_article(article_name: str) -> None:
if os.path.exists(article.path): if os.path.exists(article.path):
print(f"The article {article_name} already exists.") print(f"The article {article_name} already exists.")
sys.exit(1) sys.exit(1)
article.headers["global"]["title"] = '""' article.headers["global"]["title"] = '"Title"'
article.headers["global"]["description"] = '""' article.headers["global"]["description"] = '"Description"'
article.headers["global"]["date"] = now() article.headers["global"]["date"] = now()
article.headers["global"]["updated"] = now() article.headers["global"]["updated"] = now()
article.headers["global"]["draft"] = "true" article.headers["global"]["draft"] = "true"