A mirror of my website's source code.

Robots.txt and sitemap.txt

by steve0greatness, Monday, 15 January 2024, 07:16:00 (1705302960), pushed by steve0greatness, Monday, 6 May 2024, 02:55:34 (1714964134)

Author identity: Steve0Greatness <75220768+Steve0Greatness@users.noreply.github.com>

9976dd0d65735202c89cc296df97b80c9a3c56a9

build.py

@@ -19,6 +19,14 @@ PAGES = {

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                "404.html": "404.html"
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            }
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        DISALLOWED_SITEMAP = [
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            "404.html",
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            "blog-feed.rss"
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        ]
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        SITEMAP_HREF = "https://steve0greatness.github.io/"
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        sitemap = []
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            def WipeFinalDir():
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                if not PathExists(BUILD_DIRECTORY):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    print("Directory didn't existing, creating it...")
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -71,9 +79,12 @@ def RenderPosts():

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    print("Copying blog/%s to %s/blog/%s" % (post, BUILD_DIRECTORY, PlaintextPath))
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    with open(BUILD_DIRECTORY + "/blog/" + PlaintextPath, "w", encoding="utf-8") as PostPlaintext:
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        PostPlaintext.write(PostMD)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                sitemap.append(SITEMAP_HREF + "/blog/" + PostPath)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        def RenderPage(PageInput: str, ContentDest: str, **kwargs):
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        def RenderPage(PageInput: str, ContentDest: str, AllowSitemap: bool = True, **kwargs):
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                print("Building views/%s to %s/%s" % (PageInput, BUILD_DIRECTORY, ContentDest))
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            if AllowSitemap:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                sitemap.append(SITEMAP_HREF + ContentDest)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                with open(BUILD_DIRECTORY + "/" + ContentDest, "w", encoding="utf-8") as DestLocation:
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    DestLocation.write(RenderTemplate(PageInput, **kwargs))
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -89,6 +100,12 @@ if __name__ == "__main__":

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                print("Building pages")
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                for file, path in PAGES.items():
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                if file in DISALLOWED_SITEMAP:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    RenderPage(file, path, False, PostList=PostList)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    continue
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    RenderPage(file, path, PostList=PostList)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            with open(BUILD_DIRECTORY + "/sitemap.txt", "w") as SitemapFile:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                SitemapFile.write("\n".join(sitemap))
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                pass
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                            
                                

static/robots.txt

@@ -0,0 +1,10 @@

                                
                                
                                
                            
                                
                                    
                                        
                                        User-agent: *
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        Disallow: /src/
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        Disallow: /favicon.ico
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        Disallow: /.nojekyll
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        Disallow: /md-src.svg
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        Disallow: /rss-feed.png
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        Disallow: /toot-kytta-dev-icon.svg
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        Disallow: /blog/feed.rss
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        sitemap: https://steve0greatness.github.io