mirror of
				https://gitlab.com/octtspacc/staticoso
				synced 2025-06-05 22:09:23 +02:00 
			
		
		
		
	TXT sitemap
This commit is contained in:
		@@ -36,8 +36,8 @@ Feel free to experiment with all of this stuff!
 | 
			
		||||
- [ ] Pug support for base templates and page side parts
 | 
			
		||||
- [ ] Differential recompile (to optimize resource waste on non-ephemeral servers)
 | 
			
		||||
- [ ] Hot-recompile (for website development)
 | 
			
		||||
- [x] XML sitemap generation
 | 
			
		||||
- [x] Atom + RSS feed generation for posts
 | 
			
		||||
- [x] TXT sitemap generation
 | 
			
		||||
- [x] Atom + RSS feed generation
 | 
			
		||||
- [x] Generation of website page tree in left sidebar
 | 
			
		||||
- [x] Generation of titles in right sidebar with clickable links
 | 
			
		||||
- [x] Detections of titles in a page
 | 
			
		||||
 
 | 
			
		||||
@@ -34,6 +34,7 @@ except:
 | 
			
		||||
from Modules.Config import *
 | 
			
		||||
from Modules.Gemini import *
 | 
			
		||||
from Modules.Pug import *
 | 
			
		||||
from Modules.Sitemap import *
 | 
			
		||||
from Modules.Utils import *
 | 
			
		||||
 | 
			
		||||
Extensions = {
 | 
			
		||||
@@ -487,7 +488,7 @@ def Main(Args, FeedEntries):
 | 
			
		||||
	MastodonToken = Args.MastodonToken if Args.MastodonToken else ''
 | 
			
		||||
	MarkdownExts = literal_eval(Args.MarkdownExts) if Args.MarkdownExts else EvalOpt(ReadConf(SiteConf, 'Site', 'MarkdownExts')) if ReadConf(SiteConf, 'Site', 'MarkdownExts') else ['attr_list', 'def_list', 'markdown_del_ins', 'mdx_subscript', 'mdx_superscript']
 | 
			
		||||
 | 
			
		||||
	Minify = False # True if Args.Minify and Args.Minify not in ('False', 'None') else False
 | 
			
		||||
	Minify = False
 | 
			
		||||
	if Args.Minify != None:
 | 
			
		||||
		if Args.Minify not in ('False', 'None'):
 | 
			
		||||
			Minify = True
 | 
			
		||||
@@ -536,10 +537,10 @@ def Main(Args, FeedEntries):
 | 
			
		||||
		FolderRoots=literal_eval(Args.FolderRoots) if Args.FolderRoots else {},
 | 
			
		||||
		SiteLang=SiteLang,
 | 
			
		||||
		Locale=Locale,
 | 
			
		||||
		Minify=Minify, # Args.Minify if Args.Minify else 'None',
 | 
			
		||||
		Minify=Minify,
 | 
			
		||||
		Sorting=SetSorting(literal_eval(Args.ContextParts) if Args.ContextParts else {}),
 | 
			
		||||
		MarkdownExts=MarkdownExts,
 | 
			
		||||
		AutoCategories=AutoCategories) # Args.AutoCategories if Args.AutoCategories else EvalOpt(ReadConf(SiteConf, 'Site', 'AutoCategories')) if ReadConf(SiteConf, 'Site', 'AutoCategories') else None)
 | 
			
		||||
		AutoCategories=AutoCategories)
 | 
			
		||||
 | 
			
		||||
	if FeedEntries != 0:
 | 
			
		||||
		print("[I] Generating Feeds")
 | 
			
		||||
@@ -552,7 +553,11 @@ def Main(Args, FeedEntries):
 | 
			
		||||
				MaxEntries=FeedEntries,
 | 
			
		||||
				Lang=SiteLang,
 | 
			
		||||
				FullSite=FeedType,
 | 
			
		||||
				Minify=Minify) # True if Args.Minify and Args.Minify not in ('False', 'None') else False)
 | 
			
		||||
				Minify=Minify)
 | 
			
		||||
 | 
			
		||||
	if Args.SitemapOut:
 | 
			
		||||
		print("[I] Generating Sitemap")
 | 
			
		||||
		MakeSitemap(Pages, SiteDomain)
 | 
			
		||||
 | 
			
		||||
	if ActivityPub and MastodonURL and MastodonToken and SiteDomain:
 | 
			
		||||
		print("[I] Mastodon Stuff")
 | 
			
		||||
 
 | 
			
		||||
@@ -10,5 +10,10 @@
 | 
			
		||||
import urllib
 | 
			
		||||
from Modules.Utils import *
 | 
			
		||||
 | 
			
		||||
def MakeSitemap(Pages, SiteName, SiteTagline, SiteDomain, MaxEntries, Lang, Minify=False):
 | 
			
		||||
	return None # urllib.parse.quote(query)
 | 
			
		||||
def MakeSitemap(Pages, SiteDomain=''):
 | 
			
		||||
	Map = ''
 | 
			
		||||
	for File, Content, Titles, Meta, ContentHTML, SlimHTML, Description, Image in Pages:
 | 
			
		||||
		File = '{}.html'.format(StripExt(File))
 | 
			
		||||
		Domain = SiteDomain + '/' if SiteDomain else ' '
 | 
			
		||||
		Map += Domain + urllib.parse.quote(File) + '\n'
 | 
			
		||||
	WriteFile('public/sitemap.txt', Map)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user