• 12-08-2023, 20:18:28
    #1
    linkleri manuel ekleyip sitemap oluşturan program var mı ? tşkler.
  • 12-08-2023, 20:19:42
    #2
    python ile oluşturlabilir
  • 12-08-2023, 20:54:54
    #3
    creature1453 adlı üyeden alıntı: mesajı görüntüle
    linkleri manuel ekleyip sitemap oluşturan program var mı ? tşkler.

    
    def create_sitemap(links):
        sitemap_template = '''<?xml version="1.0" encoding="UTF-8"?>
    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    {urls}
    </urlset>'''
    
        url_template = '''<url>
      <loc>{url}</loc>
    </url>'''
    
        urls = "\n".join([url_template.format(url=link.strip()) for link in links])
    
        sitemap = sitemap_template.format(urls=urls)
        return sitemap
    
    def main():
        input_file = "linkler.txt"
        output_file = "sitemap.xml"
    
        try:
            with open(input_file, "r") as f:
                links = f.readlines()
            
            sitemap_content = create_sitemap(links)
    
            with open(output_file, "w") as f:
                f.write(sitemap_content)
    
            print(f"Sitemap oluşturuldu: {output_file}")
        
        except FileNotFoundError:
            print(f"{input_file} dosyası bulunamadı.")
        except Exception as e:
            print(f"Bir hata oluştu: {e}")
    
    if __name__ == "__main__":
        main()
  • 12-08-2023, 20:55:32
    #4
    ben sorunu çözdüm hocam tşkler