From 60c1edd829c0ee9c0f363c398dd31b6150967674 Mon Sep 17 00:00:00 2001 From: Andros Fenollosa Date: Thu, 7 Mar 2024 18:13:23 +0100 Subject: [PATCH] Add sitemap and robots --- assets/robots.txt | 4 ++++ onerc.el | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 assets/robots.txt 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)