Browse Source

change how site-wide-snippet file is stored and accessed.

The site-wide-snippet file is now a .js file and stored in /static/js
after the website's first run.
stable
Craig Oates 2 years ago
parent
commit
0ce1aef3e4
  1. 4
      src/storage.lisp
  2. 4
      src/web.lisp
  3. 1
      templates/layouts/default.html

4
src/storage.lisp

@ -40,8 +40,8 @@ This is used as part of the /run-set defroute in web.lisp file."
(uiop:copy-file (make-path "" "default-assets" "favicon.png")
(merge-pathnames "static/images/favicon.png"
ritherdon-archive.config:*application-root*))
(uiop:copy-file (make-path "" "default-assets" "site-wide-snippet")
(merge-pathnames "static/site-wide-snippet"
(uiop:copy-file (make-path "" "default-assets" "site-wide-snippet.js")
(merge-pathnames "static/js/site-wide-snippet.js"
ritherdon-archive.config:*application-root*)))
(defun directory-exists-p (username directory)

4
src/web.lisp

@ -189,7 +189,7 @@
:pages ,(nera:get-all-pages)
:system-data ,(nera:system-data)
:site-wide-snippet ,(storage:open-text-file-with-raw-path
"static/site-wide-snippet")
"static/js/site-wide-snippet.js")
;; Should this be replaced by `SYSTEM-DATA'?
:settings ,(nera:get-site-settings))))
;; Not Authorised
@ -288,7 +288,7 @@
;; Authorised
(progn
(storage:store-text-with-raw-path
"static/site-wide-snippet" code-snippet)
"static/js/site-wide-snippet.js" code-snippet)
(utils:set-alert "Site-Wide snippet updated.")
(redirect "/site-settings"))
;; Not Authorised

1
templates/layouts/default.html

@ -13,6 +13,7 @@
fabricators, steel, welding, powder paint, archive">
<link rel="stylesheet" type="text/css" media="screen" href="/css/main.css">
<link rel="icon" href="/images/favicon.png" type="image/x-icon">
<script src="/js/site-wide-snippet.js"></script>
<!-- <script defer src="/js/ritherdon-archive.js"></script> -->
</head>
<body>

Loading…
Cancel
Save