Add sitemap and robots

This commit is contained in:
Andros Fenollosa 2024-03-07 18:13:23 +01:00
parent caefd89dec
commit 60c1edd829
2 changed files with 23 additions and 0 deletions

4
assets/robots.txt Normal file
View File

@ -0,0 +1,4 @@
User-Agent: *
Allow: /
Disallow: /img/
Sitemap: https://django-liveview.andros.dev/sitemap.txt

View File

@ -1,3 +1,6 @@
;; Variables
(defvar domain "django-liveview.andros.dev")
;; Utils ;; Utils
(defun make-title (title) (defun make-title (title)
"If title is empty, return the website name. Otherwise, return the title with the website name." "If title is empty, return the website name. Otherwise, return the title with the website name."
@ -161,3 +164,19 @@
))) )))
(:main.main.main--docs (:main.main.main--docs
,content)))))) ,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)