front image used for embed preview
This commit is contained in:
parent
be6ef1f1c2
commit
1e37fcebd2
@ -3,7 +3,7 @@
|
||||
# todo: Show related git history of a file?
|
||||
|
||||
from sys import argv, exit
|
||||
import time, urllib.parse
|
||||
import time, urllib.parse, re
|
||||
|
||||
from article_utils import the_line_after_metadata, parse_metadata
|
||||
from page_shares import wrap_page, MONTHS
|
||||
@ -54,4 +54,8 @@ header = f"""HTML header: <meta property="og:title" content="{title} on mjesteč
|
||||
if not brief is None:
|
||||
header += f"""<meta property="og:description" content="{brief}"></meta>\n"""
|
||||
|
||||
front_image = re.compile(r"!\[.*\]\((.+?)\)", re.DOTALL).search(''.join(content[i:]))
|
||||
if not front_image is None:
|
||||
header += f"""<meta property="og:image" content="{argv[2]}/{urllib.parse.quote(front_image.group(1))}"></meta>\n"""
|
||||
|
||||
print(header + ''.join(content[:i]) + wrap_page(article_head + ''.join(content[i:])))
|
||||
|
Loading…
Reference in New Issue
Block a user