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 import tyto
# Load domain configuration DB # Load domain configuration DB
@ -26,6 +26,7 @@ Tyto = 'Tyto - Littérateur'
tytogit = 'https://git.a-lec.org/echolib/tyto-litterateur' tytogit = 'https://git.a-lec.org/echolib/tyto-litterateur'
tytoweb = 'https://tyto.echolib.re' tytoweb = 'https://tyto.echolib.re'
#==========================# #==========================#
# Load article DB # # Load article DB #
# Start HTML page sections # # Start HTML page sections #
@ -66,12 +67,27 @@ def create_metas_page():
relme = '\n<link rel="me" type="text/html" href="%s">'%( relme = '\n<link rel="me" type="text/html" href="%s">'%(
domain_relme 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 # 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="viewport" content="%s">\n'%scale + \
'<meta name=”url” content=”%s”>\n'%domain_url + \
'<meta name="robots" content="all">\n' + \ '<meta name="robots" content="all">\n' + \
'<meta name="medium" content="website">\n' + \ '<meta name="medium" content="website">\n' + \
'<meta name="revisit-after" content="%s">\n'%visit + \ '<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="alternate" %s />\n'%(rss_ref) + \
'<link rel="stylesheet" %s\n'%css_ref + \ '<link rel="stylesheet" %s\n'%css_ref + \
'<link rel="shortcut icon" %s />'%icon_ref + \ '<link rel="shortcut icon" %s />'%icon_ref + \
'%s'%relme '%s'%relme + \
user_metas + \
'<title>%s</title>'%title
# Create HTML tabulation for metas # 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), '22' : ':? %sNot paired%s symbols: %s'%(CY, CS, value),
'23' : ':? %sCorrupted database%s: %s'%(CY, CS, value), '23' : ':? %sCorrupted database%s: %s'%(CY, CS, value),
'24' : ':? %sfile missing%s (wip article): %s'%(CY, CS, value), '24' : ':? %sfile missing%s (wip article): %s'%(CY, CS, value),
'25' : ':D Add contents %s'%value,
'255' : ':| Maybe later...' '255' : ':| Maybe later...'
} }