This commit is contained in:
rany 2020-08-30 01:01:57 -03:00
parent 106309c46f
commit 17ab0654b9
1 changed files with 14 additions and 14 deletions

28
bb.sh
View File

@ -273,15 +273,15 @@ edit() {
twitter_card() { twitter_card() {
[[ -z $global_twitter_username ]] && return [[ -z $global_twitter_username ]] && return
echo "<meta name='twitter:card' content='summary' />" echo "<meta name='twitter:card' content='summary'>"
echo "<meta name='twitter:site' content='@$global_twitter_username' />" echo "<meta name='twitter:site' content='@$global_twitter_username'>"
echo "<meta name='twitter:title' content='$2' />" # Twitter truncates at 70 char echo "<meta name='twitter:title' content='$2'>" # Twitter truncates at 70 char
description=$(grep -v "^<p>$template_tags_line_header" "$1" | sed -e 's/<[^>]*>//g' | head -c 250 | tr '\n' ' ' | sed "s/\"/'/g") description=$(grep -v "^<p>$template_tags_line_header" "$1" | sed -e 's/<[^>]*>//g' | head -c 250 | tr '\n' ' ' | sed "s/\"/'/g")
echo "<meta name='twitter:description' content=\"$description\" />" echo "<meta name='twitter:description' content=\"$description\">"
image=$(sed -n 's/.*<img.*src="\([^"]*\)".*/\1/p' "$1" | head -n 1) # First image is fine image=$(sed -n 's/.*<img.*src="\([^"]*\)".*/\1/p' "$1" | head -n 1) # First image is fine
[[ -z $image ]] && return [[ -z $image ]] && return
[[ $image =~ ^https?:// ]] || image=$global_url/$image # Check that URL is absolute [[ $image =~ ^https?:// ]] || image=$global_url/$image # Check that URL is absolute
echo "<meta name='twitter:image' content='$image' />" echo "<meta name='twitter:image' content='$image'>"
} }
# Adds the code needed by the twitter button # Adds the code needed by the twitter button
@ -826,7 +826,7 @@ make_rss() {
echo "<description>$global_description</description><language>en</language>" echo "<description>$global_description</description><language>en</language>"
echo "<lastBuildDate>$pubdate</lastBuildDate>" echo "<lastBuildDate>$pubdate</lastBuildDate>"
echo "<pubDate>$pubdate</pubDate>" echo "<pubDate>$pubdate</pubDate>"
echo "<atom:link href=\"$global_url/$blog_feed\" rel=\"self\" type=\"application/rss+xml\" />" echo "<atom:link href=\"$global_url/$blog_feed\" rel=\"self\" type=\"application/rss+xml\">"
n=0 n=0
while IFS='' read -r i; do while IFS='' read -r i; do
@ -912,15 +912,15 @@ create_includes() {
if [[ -f $header_file ]]; then cp "$header_file" .header.html if [[ -f $header_file ]]; then cp "$header_file" .header.html
else { else {
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' echo '<!DOCTYPE html>'
echo '<html xmlns="http://www.w3.org/1999/xhtml"><head>' echo '<html><head>'
echo '<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />' echo '<meta http-equiv="Content-type" content="text/html;charset=UTF-8">'
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0" />' echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">'
printf '<link rel="stylesheet" href="%s" type="text/css" />\n' "${css_include[@]}" printf '<link rel="stylesheet" href="%s" type="text/css">\n' "${css_include[@]}"
if [[ -z $global_feedburner ]]; then if [[ -z $global_feedburner ]]; then
echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$template_subscribe_browser_button\" href=\"$blog_feed\" />" echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$template_subscribe_browser_button\" href=\"$blog_feed\">"
else else
echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$template_subscribe_browser_button\" href=\"$global_feedburner\" />" echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$template_subscribe_browser_button\" href=\"$global_feedburner\">"
fi fi
} > ".header.html" } > ".header.html"
fi fi
@ -929,7 +929,7 @@ create_includes() {
else { else {
protected_mail=${global_email//@/&#64;} protected_mail=${global_email//@/&#64;}
protected_mail=${protected_mail//./&#46;} protected_mail=${protected_mail//./&#46;}
echo "<div id=\"footer\">$global_license <a href=\"$global_author_url\">$global_author</a> &mdash; <a href=\"mailto:$protected_mail\">$protected_mail</a><br/>" echo "<div id=\"footer\">$global_license <a href=\"$global_author_url\">$global_author</a> &mdash; <a href=\"mailto:$protected_mail\">$protected_mail</a><br>"
echo 'generated with <a href="https://tildegit.org/team/bashblog">bashblog</a>, a single bash script to easily create blogs like this one</div>' echo 'generated with <a href="https://tildegit.org/team/bashblog">bashblog</a>, a single bash script to easily create blogs like this one</div>'
} >> ".footer.html" } >> ".footer.html"
fi fi