Remove links to dead fedi posts, add header for improved fediverse discoverability

master
trémeur 3 months ago
parent 4ca740c07c
commit 2c877c77e2

@ -1,11 +1,14 @@
def headerwrite(output,title,headerone,desc,main=False,local=False): def headerwrite(output,title,headerone,desc,main=False,local=False,single=False,ficnostring=False):
header = open(output, "a") header = open(output, "a")
header.write("<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<link rel=\"stylesheet\" href=\"") header.write("<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<link rel=\"stylesheet\" href=\"")
if local: if local:
header.write("/home/mdd/Documents/proj/fic-archive/build/") header.write("/home/mdd/Documents/proj/fic-archive/build/")
else: else:
header.write("/fic/") header.write("/fic/")
header.write("archive.css\">\n<link rel=\"me\" href=\"https://ple.praze.net/users/tre\">\n<link rel=\"alternate\" type=\"application/rss+xml\" title=\"Tré's fic archive\" href=\"https://tre.praze.net/fic/feed.xml\">\n<meta name=\"theme-color\" content=\"#edc4c4\" />\n<title>" + title + "</title>\n<meta property=\"og:title\" content=\"Trés fanfiction\">\n<meta property=\"og:type\" content=\"website\">\n<meta property=\"og:image\" content=\"https://tre.praze.net/ab.png\">\n<meta name=\"description\" property=\"og:description\" content=\"Fanfiction on tre.praze.net\">\n<meta property=\"og:locale\" content=\"en_GB\">\n<meta property=\"og:site_name\" content=\"tre.praze.net\">\n<meta name=\"fediverse:creator\" content=\"@tre@ple.praze.net\">\n<noscript>\n<style>.jsonly{display:none;}</style>\n</noscript>\n</head>\n<body>\n<div id=\"content\">\n<div id=\"inside\">\n<noscript>\n<div id=\"warning\">\n<p><b>Warning:</b> this part of my site is <b>18+</b>. Fics contain NSFW material and mature themes (death, suicide, mental illness, incest …). Browse at your own risk.</p>\n</div>\n</noscript>\n<h1>" + headerone + "</h1>\n" + desc + "\n") header.write("archive.css\">\n<link rel=\"me\" href=\"https://ple.praze.net/users/tre\">\n<link rel=\"alternate\" type=\"application/rss+xml\" title=\"Tré's fic archive\" href=\"https://tre.praze.net/fic/feed.xml\">\n<meta name=\"theme-color\" content=\"#edc4c4\" />\n<title>" + title + "</title>\n<meta property=\"og:title\" content=\"Trés fanfiction\">\n<meta property=\"og:type\" content=\"website\">\n<meta property=\"og:image\" content=\"https://tre.praze.net/ab.png\">\n<meta name=\"description\" property=\"og:description\" content=\"Fanfiction on tre.praze.net\">\n<meta property=\"og:locale\" content=\"en_GB\">\n<meta property=\"og:site_name\" content=\"tre.praze.net\">\n<meta name=\"fediverse:creator\" content=\"@tre@praze.net\">\n")
if single:
header.write("<link rel=\"alternate\" type=\"application/activity+json\" href=\"https://fed.brid.gy/r/https://tre.praze.net/fic/single/" + ficnostring + "/\"")
header.write("<noscript>\n<style>.jsonly{display:none;}</style>\n</noscript>\n</head>\n<body>\n<div id=\"content\">\n<div id=\"inside\">\n<noscript>\n<div id=\"warning\">\n<p><b>Warning:</b> this part of my site is <b>18+</b>. Fics contain NSFW material and mature themes (death, suicide, mental illness, incest …). Browse at your own risk.</p>\n</div>\n</noscript>\n<h1>" + headerone + "</h1>\n" + desc + "\n")
if not main: if not main:
header.write("<p>\n<a href=\"") header.write("<p>\n<a href=\"")
if local: if local:

@ -103,10 +103,10 @@ def linkgen(ficno,output="output.html",local=False):
except: except:
pass pass
# write fedi share link if there is one # write fedi share link if there is one
try: # try:
filewrite.write("<li><a href=\"https://ple.praze.net/notice/" + fileread.fedislug + "\">fedi</a></li>\n") # filewrite.write("<li><a href=\"https://ple.praze.net/notice/" + fileread.fedislug + "\">fedi</a></li>\n")
except: # except:
pass # pass
# determine if comments page # determine if comments page
if any(item in fffandoms for item in fileread.fandom): if any(item in fffandoms for item in fileread.fandom):
filewrite.write("<li class=\"prazelink\"><a href=\"") filewrite.write("<li class=\"prazelink\"><a href=\"")
@ -295,7 +295,7 @@ def ficgen(ficno,unique=False,output="output.html",local=False,single=False):
if local: if local:
filewrite.write("/home/mdd/Documents/proj/fic-archive/build/single/" + ficnostring + "/index.html") filewrite.write("/home/mdd/Documents/proj/fic-archive/build/single/" + ficnostring + "/index.html")
else: else:
filewrite.write("/fic/single/" + ficnostring) filewrite.write("/fic/single/" + ficnostring + "/")
filewrite.write("\">" + ficnostring + "</a>") filewrite.write("\">" + ficnostring + "</a>")
try: try:
if translationstring: if translationstring:

@ -34,7 +34,7 @@ def singlepage(ficno,directory,local=False):
os.remove(singlepath + "/index.html") os.remove(singlepath + "/index.html")
# write to output file # write to output file
output = singlepath + "/index.html" output = singlepath + "/index.html"
headerfooter.headerwrite(output,"Fic no. " + ficnostring,"Fic no. <span id=\"ficno\">" + ficnostring + "</span>","",False,local) headerfooter.headerwrite(output,"Fic no. " + ficnostring,"Fic no. <span id=\"ficno\">" + ficnostring + "</span>","",False,local,single=True,ficnostring=ficnostring)
try: try:
if fileread.original: if fileread.original:
makeheader.ficgen(fileread.original,False,output,local,True) makeheader.ficgen(fileread.original,False,output,local,True)

Loading…
Cancel
Save