~npisanti/npisantidotcomssg

b1ef535cb62185e0cf1fb4210dd6b0b8c242d70c — Nicola Pisanti a month ago f01b194
updates to redirects
2 files changed, 27 insertions(+), 20 deletions(-)

M build.sh
M upload_html.sh
M build.sh => build.sh +18 -17
@@ 65,23 65,21 @@ function open_page #------------------------------------------------------------
	set -a text '\n<html>'
	set -a text '\n<head>'
	set -a text '\n<meta charset="utf-8" />'

	if test -n $argv[2] 
		set -a text "\n<title>[ $argv[2] ]</title>"
	else
		set -a text "\n<title>[ npisanti.com]</title>"
	end 

	set -a text "\n"(cat input/base/head.html) 

	set -a text (og_image_path "$argv[1]") 

	set -a text '\n<meta property="og:image:height" content="230" />'
	set -a text '\n<meta property="og:image:width" content="230" />'
	
    # TODO get width and height someway from image 
	#set -a text '\n<meta property="og:image:height" content="230" />'
	#set -a text '\n<meta property="og:image:width" content="230" />'

	set -a text "\n</head>"
	set -a text "\n<body>"

	echo $text
end



@@ 341,23 339,25 @@ function build_rss #------------------------------------------------------------
	printf "\n"
end

function build_index_redirect #--------------------------------------------------
	echo "creating index redirect..."
	set    text '<!DOCTYPE html>'
	set -a text '\n<html>\n<head>\n<meta charset="utf-8" />'
function build_redirect #--------------------------------------------------------
    set -l from "$argv[1]"
    set -l dest "$argv[2]"
	echo "creating redirect from $from to $dest"
	set    text "<!DOCTYPE html>"
	set -a text "\n<html>\n<head>\n<meta charset=\"utf-8\" />"
	set -a text "\n<title>[ npisanti.com]</title>"
	set -a text "\n"(cat input/base/head.html) 
	set -a text (og_image_path) 
	set -a text '\n<meta property="og:image:height" content="230" />'
	set -a text '\n<meta property="og:image:width" content="230" />'
	set -a text '\n<meta http-equiv="refresh" content="0;url=main/index.html" />'
	set -a text "\n<meta property=\"og:image:height\" content=\"230\" />"
	set -a text "\n<meta property=\"og:image:width\" content=\"230\" />"
	set -a text "\n<meta http-equiv=\"refresh\" content=\"0;url=$dest\" />"
	set -a text "\n</head>"
	set -a text "\n<body>"
	set -a text "\n<br/><br/>redirecting to main/index.html..."
	set -a text "\n<br/><br/>redirecting to $dest..."
	set -a text "\n</body>"
	set -a text "\n</html>"
	set text (echo $text | sed -e "s|SITEROOTPATH|.|g") 
	echo -e $text > "$OUTFOLDER/index.html"
	echo -e $text > "$OUTFOLDER/$from"
end

#--------------------- EXECUTES ALL THE FUNCTIONS -------------------------------


@@ 369,11 369,12 @@ for dir in $CATEGORIES; build_feed $dir; end
build_posts
build_archives
build_rss
build_index_redirect

build_redirect "index.html" "main/index.html"
cp "input/base/style.css" "$OUTFOLDER/style.css"

# retrocompatibiliy
build_redirect "about.html" "pages/contact.html"
build_redirect "hexaglyphics.html" "pages/hexaglyphics.html"
mkdir -p "$OUTFOLDER/journal"
cp "$OUTFOLDER/rss.xml" "$OUTFOLDER/journal/rss.xml"


M upload_html.sh => upload_html.sh +9 -3
@@ 3,7 3,7 @@
echo 'the ftp transfer used in this script is not encrypted, are you behind a trusted connection?'
	
while true
    set yn (read -P [y/n]: ) 
    set yn (read -P "[y/n]: ") 

	switch "$yn"
    case Y y yes


@@ 16,8 16,8 @@ while true
    end
end

set ftpuser (read -P user: )
set ftppass (read -s -P password: )
set ftpuser (read -P "user: " )
set ftppass (read -s -P "password: " )

echo ""



@@ 35,6 35,12 @@ ncftpput -u "$ftpuser" -p "$ftppass" ftp.npisanti.com public_html ~/htdocs/npisa

echo "uploading RSS"
ncftpput -u "$ftpuser" -p "$ftppass" ftp.npisanti.com public_html ~/htdocs/npisantidotcomssg/html_output/rss.xml


echo "uploading for retrocompatibility..."
ncftpput -u "$ftpuser" -p "$ftppass" ftp.npisanti.com public_html ~/htdocs/npisantidotcomssg/html_output/hexaglyphics.html
ncftpput -u "$ftpuser" -p "$ftppass" ftp.npisanti.com public_html ~/htdocs/npisantidotcomssg/html_output/about.html
ncftpput -u "$ftpuser" -p "$ftppass" ftp.npisanti.com public_html/journal ~/htdocs/npisantidotcomssg/html_output/journal/rss.xml


exit