diff --git a/assets/robots.txt b/assets/robots.txt new file mode 100644 index 0000000..08c7299 --- /dev/null +++ b/assets/robots.txt @@ -0,0 +1,4 @@ +User-Agent: * +Allow: / +Disallow: /img/ +Sitemap: https://django-liveview.andros.dev/sitemap.txt diff --git a/onerc.el b/onerc.el index 91a5b4b..aafbf06 100644 --- a/onerc.el +++ b/onerc.el @@ -1,3 +1,6 @@ +;; Variables +(defvar domain "django-liveview.andros.dev") + ;; Utils (defun make-title (title) "If title is empty, return the website name. Otherwise, return the title with the website name." @@ -161,3 +164,19 @@ ))) (:main.main.main--docs ,content)))))) + +;; Sitemap + +(defun make-sitemap (pages tree global) + "Produce file ./public/sitemap.txt" + (with-temp-file "./public/sitemap.txt" + (insert + (mapconcat 'identity (mapcar + (lambda (page) + (let* ((path (plist-get page :one-path)) + (link (concat "https://" domain path))) + link + )) + pages) "\n")))) + +(add-hook 'one-hook 'make-sitemap)