add website
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
from flask import render_template
|
||||
|
||||
SITE_BASE_URL = "https://www.nexium.fit"
|
||||
SITE_NAME = "NEXIUM"
|
||||
|
||||
def _TruncateText(text: str, limit: int = 300) -> str:
|
||||
if not text:
|
||||
return ""
|
||||
text = " ".join(text.split())
|
||||
if len(text) <= limit:
|
||||
return text
|
||||
return text[:limit - 1].rstrip() + "…"
|
||||
|
||||
def RenderAssetEmbed(title: str, description: str, image_path: str, canonical_path: str, large_image: bool = True):
|
||||
return render_template(
|
||||
"__embed__.html",
|
||||
og_title=title,
|
||||
og_description=_TruncateText(description),
|
||||
og_image=SITE_BASE_URL + image_path,
|
||||
og_url=SITE_BASE_URL + canonical_path,
|
||||
site_name=SITE_NAME,
|
||||
twitter_card="summary_large_image" if large_image else "summary"
|
||||
)
|
||||
Reference in New Issue
Block a user