256 lines
7.4 KiB
Plaintext
256 lines
7.4 KiB
Plaintext
|
#!/bin/bash
|
||
|
# file: gsl__HTML_template
|
||
|
# Folder: /var/lib/gsl/scripts
|
||
|
# By echolib (XMPP: im@echolib.re)
|
||
|
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||
|
|
||
|
|
||
|
#======================================================================
|
||
|
# HTML code for <heade>
|
||
|
#
|
||
|
# You can edit this function and create your needed HTML code
|
||
|
# After editing DO: gsl make -F
|
||
|
# for all your pages to be updated
|
||
|
#======================================================================
|
||
|
create__HTML_header() {
|
||
|
cat <<EOHEADER
|
||
|
<header id="${site_css}_banner">
|
||
|
<div id="${site_css}_site-logo">
|
||
|
<a href="/">
|
||
|
<img src="${srv_uri}templates/$site_logo"
|
||
|
alt="Logo: $site_title"
|
||
|
title="Logo: $site_title"/>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<div id="${site_css}_site-title">
|
||
|
<h1 id="${site_css}_site-name">
|
||
|
<a href="/"
|
||
|
title="$gsl_welcome $site_itle">
|
||
|
$site_title
|
||
|
</a>
|
||
|
</h1>
|
||
|
|
||
|
<h2 id="${site_css}_site-description">$site_about</h2>
|
||
|
</div>
|
||
|
</header>
|
||
|
EOHEADER
|
||
|
}
|
||
|
|
||
|
|
||
|
#======================================================================
|
||
|
# HTML code in <footer>
|
||
|
# /domains/DOMAIN/templates/footer.html
|
||
|
# ! DO NOT EDIT this function
|
||
|
# It creates file -IF NOT EXISTS-
|
||
|
#
|
||
|
# Add / Edit your own
|
||
|
# Create or Edit file /domains/DOMAIN/templates/footer.html
|
||
|
# After editing DO: gsl make -F
|
||
|
# for all your pages to be updated
|
||
|
#======================================================================
|
||
|
create__HTML_footer() {
|
||
|
cat <<EOFOOTER > "$gsl_dir_domain_tpl/footer.html"
|
||
|
<footer id="${site_css}_footer">
|
||
|
<h1>$gsl_about $site_title</h1>
|
||
|
<div id="${site_css}_footer-infos">
|
||
|
<p>...<p>
|
||
|
</div>
|
||
|
|
||
|
<div id="${site_css}_footer-about">
|
||
|
<p class="${site_css_footer-p}">
|
||
|
<a href="$site_url">
|
||
|
<b>$site_title</b>
|
||
|
</a>: $site_about
|
||
|
<br />
|
||
|
Contact: $site_mail
|
||
|
<br />
|
||
|
Copyright: $site_cr
|
||
|
<br />
|
||
|
$gsl_gen: <a href="https://git.a-lec.org/echolib/gsl" target="_blank">
|
||
|
<b>GSL: Statique Littérateur</b>
|
||
|
</a>
|
||
|
</p>
|
||
|
</div>
|
||
|
</footer>
|
||
|
EOFOOTER
|
||
|
}
|
||
|
|
||
|
|
||
|
#======================================================================
|
||
|
# Translate some static words according to site_lang
|
||
|
#======================================================================
|
||
|
create__HTML_translation() {
|
||
|
if [[ `grep -i "fr" <<<"$site_lang"` ]];then
|
||
|
gsl_welcome="Page d'accueil de"
|
||
|
gsl_written="Écrit par"
|
||
|
gsl_about=" À propos de"
|
||
|
gsl_gen="Propulsé par"
|
||
|
gsl_the="Le"
|
||
|
gsl_by="par"
|
||
|
gsl_read="Lire l'article de"
|
||
|
|
||
|
else
|
||
|
gsl_welcome="Welcome page of"
|
||
|
gsl_written="Written by"
|
||
|
gsl_bout="About"
|
||
|
gsl_gen="Generated with"
|
||
|
gsl_the="The"
|
||
|
gsl_by="by"
|
||
|
gsl_read="Read the post of"
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
|
||
|
#======================================================================
|
||
|
# Page Template
|
||
|
#======================================================================
|
||
|
create__HTML_page() {
|
||
|
create__HTML_translation
|
||
|
|
||
|
! [[ -f "$gsl_dir_domain_tpl/metas.html" ]] \
|
||
|
&& create__HTML_metas
|
||
|
|
||
|
! [[ -f "$gsl_dir_domain_tpl/footer.html" ]] \
|
||
|
&& create__HTML_footer
|
||
|
|
||
|
# Create sub-directories if post only
|
||
|
[[ $article_Type == "post" ]] \
|
||
|
&& mkdir -p "$gsl_srv_wip/$article_Slug"
|
||
|
|
||
|
cat <<EOPAGE > "$gsl_srv_post_wip"
|
||
|
<!DOCTYPE html>
|
||
|
<html lang="${site_lang: :2}">
|
||
|
<head>
|
||
|
$(cat "$gsl_dir_domain_tpl/metas.html")
|
||
|
<meta name='generator' content="GSL: Statique Littérateur">
|
||
|
|
||
|
<meta name='title' content="$article_Title | $site_title">
|
||
|
<meta name='author' content="$article_Author">
|
||
|
<meta name='description' content="$article_Info">
|
||
|
<meta name='keywords' content="$site_keys,$article_Tags">
|
||
|
<meta name='search_date' content="$article_Date">
|
||
|
|
||
|
<link rel="stylesheet" media="screen" href="${srv_uri}templates/styles.css" />
|
||
|
<link rel="shortcut icon" type="image/png" href="${srv_uri}templates/favicon.png" />
|
||
|
<link rel='me' type='text/html' href="$site_auth_url">
|
||
|
<title>$article_Title - $site_title</title>
|
||
|
</head>
|
||
|
|
||
|
<body id="${site_css}_$article_Type$article_CSS">
|
||
|
$(create__HTML_header)
|
||
|
|
||
|
<section id="${site_css}_page-wrapper">
|
||
|
<article id="${site_css}_$article_Slug">
|
||
|
|
||
|
<div id="${site_css}_metas">
|
||
|
<p id="${site_css}_auteur">$gsl_written <strong>$article_Author</strong> - $article_Date</p>
|
||
|
</div>
|
||
|
|
||
|
$(cat "$gsl_tmp_post")
|
||
|
|
||
|
</article>
|
||
|
|
||
|
<aside id="${site_css}_sidebar">
|
||
|
<div class="${ite_css}_wrapper" role="navigation">
|
||
|
<nav id="${site_css}_latest-posts">
|
||
|
<h1 class="${site_css}_latest-posts">$site_listname</h1>
|
||
|
<ul class="${site_css}_latest-posts"
|
||
|
aria-label="$site_listname">
|
||
|
<!--# include file="${srv_uri}templates/sidebar.html" -->
|
||
|
</ul>
|
||
|
</nav>
|
||
|
</div>
|
||
|
</aside>
|
||
|
</section>
|
||
|
|
||
|
$(cat "$gsl_dir_domain_tpl/footer.html")
|
||
|
|
||
|
</body>
|
||
|
</html>
|
||
|
EOPAGE
|
||
|
|
||
|
gsl__logs_print -i -S -wip \
|
||
|
"Created HTML $article_Type" \
|
||
|
"$gsl_srv_post_wip"
|
||
|
}
|
||
|
|
||
|
|
||
|
#======================================================================
|
||
|
# METAS in <head>
|
||
|
# /domains/DOMAIN/templates/metas.html
|
||
|
# ! DO NOT EDIT this function
|
||
|
# It creates file -IF NOT EXISTS-
|
||
|
#
|
||
|
# Edit your values in the file....
|
||
|
# After editing DO: gsl make -F
|
||
|
# for all your pages to be updated
|
||
|
#======================================================================
|
||
|
create__HTML_metas() {
|
||
|
cat <<EOMETAS > "$gsl_dir_domain_tpl/metas.html"
|
||
|
<meta charset="UTF-8" />
|
||
|
<meta name='viewport' content="width=device-width, initial-scale=1.0">
|
||
|
<meta name='robots' content="all">
|
||
|
<meta name='medium' content='website'>
|
||
|
<meta name='revisit-after' content="3 days">
|
||
|
<meta name='language' content="$site_lang">
|
||
|
<meta name='reply-to' content="$site_mail">
|
||
|
<meta name='copyright' content="$site_cr">
|
||
|
EOMETAS
|
||
|
}
|
||
|
|
||
|
|
||
|
#======================================================================
|
||
|
# Called from sidebar__create in gsl__post_makers
|
||
|
# file: /var/lib/gsl/domains/DOMAIN/X-tra/sidebar/[POSITION].html
|
||
|
# You can edit this HTML code for your needs
|
||
|
# It can get all Values from Database post
|
||
|
# $1: file ($sidebar_HTML_item - see above)
|
||
|
#======================================================================
|
||
|
create__HTML_sidebar_item() {
|
||
|
cat <<EOSIDEBARITEM > "$1"
|
||
|
<li class="${site_css}_list-post-item">
|
||
|
<a href="/$gsl_slug_file"
|
||
|
class="a-lec_list-post-link"
|
||
|
title="$gsl_read $article_Author: $article_Title">
|
||
|
|
||
|
<span class="a-lec_list-post-title">$article_Title</span>
|
||
|
|
||
|
<div class="a-lec_list-post-metas">
|
||
|
$gsl_the $article_Date $gsl_by $article_Author
|
||
|
</div>
|
||
|
|
||
|
<div class="a-lec_list-post-info">
|
||
|
$article_Info
|
||
|
</div>
|
||
|
</a>
|
||
|
</li>
|
||
|
EOSIDEBARITEM
|
||
|
}
|
||
|
|
||
|
|
||
|
#======================================================================
|
||
|
# Called from sidebar__create in gsl__post_makers
|
||
|
# $1: log process
|
||
|
# $2: file: /var/lib/gsl/domains/DOMAIN/templates/sidebar.html
|
||
|
#======================================================================
|
||
|
create__HTML_sidebar() {
|
||
|
gsl_post="sidebar.html"
|
||
|
[[ -f "$2" ]] \
|
||
|
&& rm -f "$2" \
|
||
|
&& gsl__logs_print -w -s $1 \
|
||
|
"Removed to Set new one" \
|
||
|
"$2"
|
||
|
|
||
|
for i in `seq 1 $site_max_list`
|
||
|
do
|
||
|
[[ -f "$gsl_dir_domain_sidebar/$i.html" ]] \
|
||
|
&& cat "$gsl_dir_domain_sidebar/$i.html" \
|
||
|
>> "$2"
|
||
|
done
|
||
|
|
||
|
gsl__logs_print -i -s "$1" \
|
||
|
"Created" \
|
||
|
"$2"
|
||
|
}
|