HTML: <meta> tags. Add content of wip/template/metas.html (if exists)

This commit is contained in:
Cyrille L 2023-01-06 10:09:55 +01:00
parent 87c79b803d
commit aa99f32c46
2 changed files with 23 additions and 4 deletions

View File

@ -16,7 +16,7 @@
#----------------------------------------------------------------------
#**********************************************************************
import os
import tyto
# Load domain configuration DB
@ -26,6 +26,7 @@ Tyto = 'Tyto - Littérateur'
tytogit = 'https://git.a-lec.org/echolib/tyto-litterateur'
tytoweb = 'https://tyto.echolib.re'
#==========================#
# Load article DB #
# Start HTML page sections #
@ -67,11 +68,26 @@ def create_metas_page():
domain_relme
)
# Check for user metas from wip template/metas.html
#--------------------------------------------------
metas_file = '%smetas.html'%srv_wip_tpl
user_metas = ''
try:
user_file = open(metas_file, 'r').read()
tyto.exiting("25", 'metas from: %s'%metas_file, False)
for line in user_file.rsplit('\n'):
if line.startswith('<meta '):
if user_metas: user_metas = "%s\n%s"%(user_metas, line)
else: user_metas = '\n%s'%line
user_metas = '%s\n'%user_metas
except:
pass
# Set all raw HTML metas
#-----------------------
metas = '<meta charset="utf-8">\n' + \
metas = '<meta charset="UTF-8">\n' + \
'<meta name="viewport" content="%s">\n'%scale + \
'<meta name=”url” content=”%s”>\n'%domain_url + \
'<meta name="robots" content="all">\n' + \
'<meta name="medium" content="website">\n' + \
'<meta name="revisit-after" content="%s">\n'%visit + \
@ -88,7 +104,9 @@ def create_metas_page():
'<link rel="alternate" %s />\n'%(rss_ref) + \
'<link rel="stylesheet" %s\n'%css_ref + \
'<link rel="shortcut icon" %s />'%icon_ref + \
'%s'%relme
'%s'%relme + \
user_metas + \
'<title>%s</title>'%title
# Create HTML tabulation for metas

View File

@ -504,6 +504,7 @@ def exiting(nbr, value, out):
'22' : ':? %sNot paired%s symbols: %s'%(CY, CS, value),
'23' : ':? %sCorrupted database%s: %s'%(CY, CS, value),
'24' : ':? %sfile missing%s (wip article): %s'%(CY, CS, value),
'25' : ':D Add contents %s'%value,
'255' : ':| Maybe later...'
}