From 9dc5629622376a14ced3e95aafb61473f864e54c Mon Sep 17 00:00:00 2001 From: Dominic Freeston Date: Sat, 15 Jun 2019 20:45:47 +0100 Subject: [PATCH] Update template project structure to reflect cryogen-project/cryogen-core#117 (#184) * Map files to new project structure * Update lotus theme config * Update server.clj to match new structure * Update documentation * Update gitignore * Fix highlight.js docs --- README.md | 25 ++- src/leiningen/new/cryogen.clj | 162 +++++++++--------- src/leiningen/new/cryogen/gitignore | 2 +- .../new/cryogen/md/posts/2016-01-07-docs.md | 18 +- .../new/cryogen/src/cryogen/server.clj | 18 +- .../new/cryogen/themes/lotus/README.md | 2 +- .../new/cryogen/themes/lotus/config.edn | 4 +- 7 files changed, 115 insertions(+), 116 deletions(-) diff --git a/README.md b/README.md index d996faa..49ffb79 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ The web server can be started from the `my-blog` directory using the `lein-ring` lein ring server ``` -The server will watch for changes in the `resources/templates` folder and recompile the content automatically. +The server will watch for changes in the `content` and `themes` folders and recompile the content automatically. You can also generate the content without bringing up a server via: @@ -57,7 +57,7 @@ lein run ### Site Configuration -The site configuration file is found at `templates/config.edn`, this file looks as follows: +The site configuration file is found at `content/config.edn`, this file looks as follows: ```clojure {:site-title "My Awesome Blog" @@ -88,7 +88,7 @@ The site configuration file is found at `templates/config.edn`, this file looks :posts-per-page 5 :blocks-per-preview 2 :previews? false - :clean-urls? true + :clean-urls :trailing-slash :hide-future-posts? true :klipse {} :debug? false} @@ -99,26 +99,23 @@ For information about each key please see the ["Configuration"](http://cryogenwe ### Switching between Markdown and AsciiDoc Cryogen comes with Markdown support as default. If you want to use AsciiDoc instead, open the `project.clj` in your created blog (e.g. `my-blog`), and change the line in `:dependencies` that says `cryogen-markdown` to `cryogen-asciidoc`. -Instead of looking for files ending in `.md` in the `resources/templates/md` directory, the compiler will now look for files ending in `.asc` in the `resources/templates/asc` directory. +Instead of looking for files ending in `.md` in the `content/md` directory, the compiler will now look for files ending in `.asc` in the `content/asc` directory. ### Selecting a Theme -The Cryogen template comes with three themes in the `resources/templates/themes` folder. To change your blog's theme, change the value of the `:theme` key in `config.edn`. -Note that the Nucleus theme is obtained from [downloadwebsitetemplates.co.uk](http://www.downloadwebsitetemplates.co.uk/template/nucleus/) that requires you to keep the footer, unless you make a donation on their website. +The Cryogen template comes with three themes in the `themes` folder. To change your blog's theme, change the value of the `:theme` key in `config.edn`. Note that the Nucleus theme is obtained from [downloadwebsitetemplates.co.uk](http://www.downloadwebsitetemplates.co.uk/template/nucleus/) that requires you to keep the footer, unless you make a donation on their website. ### Customizing Layouts -Cryogen uses [Selmer](https://github.com/yogthos/Selmer) templating engine for layouts. Please refer to its documentation -to see the supported tags and filters for the layouts. +Cryogen uses [Selmer](https://github.com/yogthos/Selmer) templating engine for layouts. Please refer to its documentation to see the supported tags and filters for the layouts. -The layouts are contained in the `resources/templates/themes/{theme}/html` folder of the project. By default, the `base.html` layout is used to provide the general layout for the site. This is where you would add static resources such as CSS and JavaScript -assets as well as define headers and footers for your site. +The layouts are contained in the `themes/{theme}/html` folder of the project. By default, the `base.html` layout is used to provide the general layout for the site. This is where you would add static resources such as CSS and JavaScript assets as well as define headers and footers for your site. Each page layout should have a name that matches the `:layout` key in the page metadata and end with `.html`. Page layouts extend the base layout and should only contain the content relaveant to the page inside the `content` block. For example, the `tag` layout is located in `tag.html` and looks as follows: ```xml -{% extends "templates/html/layouts/base.html" %} +{% extends "/html/base.html" %} {% block content %}

Posts tagged {{name}}

@@ -135,9 +132,9 @@ For example, the `tag` layout is located in `tag.html` and looks as follows: ### Code Syntax Highlighting -Cryogen uses [Highlight.js](https://highlightjs.org/) for code syntax highlighting. You can add more languages by replacing `templates/js/highlight.pack.js` with a customized package from [here](https://highlightjs.org/download/). +Cryogen uses [Highlight.js](https://highlightjs.org/) for code syntax highlighting. You can add more languages by replacing `themes/{theme}/js/highlight.pack.js` with a customized package from [here](https://highlightjs.org/download/). -The ` initHighlightingOnLoad` function is called in `{theme}/html/base.html`. +The ` initHighlightingOnLoad` function is called in `themes/{theme}/html/base.html`. ```xml @@ -145,7 +142,7 @@ The ` initHighlightingOnLoad` function is called in `{theme}/html/base.html`. ## Deploying Your Site -The generated static content will be found under the `resources/public` folder. Simply copy the content to a static +The generated static content will be found under the `public` folder. Simply copy the content to a static folder for a server such as Nginx or Apache and your site is now ready for service. A sample Nginx configuration that's placed in `/etc/nginx/sites-available/default` can be seen below: diff --git a/src/leiningen/new/cryogen.clj b/src/leiningen/new/cryogen.clj index 3756721..23dad3f 100644 --- a/src/leiningen/new/cryogen.clj +++ b/src/leiningen/new/cryogen.clj @@ -14,82 +14,82 @@ (throw (new Exception "Leiningen v2 is required...")))) (def blue-theme - [["resources/templates/themes/blue/html/archives.html" (render "themes/blue/html/archives.html")] - ["resources/templates/themes/blue/html/author.html" (render "themes/blue/html/author.html")] - ["resources/templates/themes/blue/html/base.html" (render "themes/blue/html/base.html")] - ["resources/templates/themes/blue/html/home.html" (render "themes/blue/html/home.html")] - ["resources/templates/themes/blue/html/page.html" (render "themes/blue/html/page.html")] - ["resources/templates/themes/blue/html/post.html" (render "themes/blue/html/post.html")] - ["resources/templates/themes/blue/html/post-content.html" (render "themes/blue/html/post-content.html")] - ["resources/templates/themes/blue/html/previews.html" (render "themes/blue/html/previews.html")] - ["resources/templates/themes/blue/html/tag.html" (render "themes/blue/html/tag.html")] - ["resources/templates/themes/blue/html/tags.html" (render "themes/blue/html/tags.html")] - ["resources/templates/themes/blue/html/404.html" (render "themes/blue/html/404.html")] - ["resources/templates/themes/blue/css/screen.css" (render "themes/blue/css/screen.css")] - ["resources/templates/themes/blue/js/highlight.pack.js" (render "themes/blue/js/highlight.pack.js")]]) + [["themes/blue/html/archives.html" (render "themes/blue/html/archives.html")] + ["themes/blue/html/author.html" (render "themes/blue/html/author.html")] + ["themes/blue/html/base.html" (render "themes/blue/html/base.html")] + ["themes/blue/html/home.html" (render "themes/blue/html/home.html")] + ["themes/blue/html/page.html" (render "themes/blue/html/page.html")] + ["themes/blue/html/post.html" (render "themes/blue/html/post.html")] + ["themes/blue/html/post-content.html" (render "themes/blue/html/post-content.html")] + ["themes/blue/html/previews.html" (render "themes/blue/html/previews.html")] + ["themes/blue/html/tag.html" (render "themes/blue/html/tag.html")] + ["themes/blue/html/tags.html" (render "themes/blue/html/tags.html")] + ["themes/blue/html/404.html" (render "themes/blue/html/404.html")] + ["themes/blue/css/screen.css" (render "themes/blue/css/screen.css")] + ["themes/blue/js/highlight.pack.js" (render "themes/blue/js/highlight.pack.js")]]) (def blue-centered-theme - [["resources/templates/themes/blue_centered/html/archives.html" (render "themes/blue_centered/html/archives.html")] - ["resources/templates/themes/blue_centered/html/author.html" (render "themes/blue_centered/html/author.html")] - ["resources/templates/themes/blue_centered/html/base.html" (render "themes/blue_centered/html/base.html")] - ["resources/templates/themes/blue_centered/html/home.html" (render "themes/blue_centered/html/home.html")] - ["resources/templates/themes/blue_centered/html/page.html" (render "themes/blue_centered/html/page.html")] - ["resources/templates/themes/blue_centered/html/post.html" (render "themes/blue_centered/html/post.html")] - ["resources/templates/themes/blue_centered/html/post-content.html" (render "themes/blue_centered/html/post-content.html")] - ["resources/templates/themes/blue_centered/html/previews.html" (render "themes/blue_centered/html/previews.html")] - ["resources/templates/themes/blue_centered/html/tag.html" (render "themes/blue_centered/html/tag.html")] - ["resources/templates/themes/blue_centered/html/tags.html" (render "themes/blue_centered/html/tags.html")] - ["resources/templates/themes/blue_centered/html/404.html" (render "themes/blue_centered/html/404.html")] - ["resources/templates/themes/blue_centered/css/screen.css" (render "themes/blue_centered/css/screen.css")] - ["resources/templates/themes/blue_centered/js/highlight.pack.js" (render "themes/blue_centered/js/highlight.pack.js")]]) + [["themes/blue_centered/html/archives.html" (render "themes/blue_centered/html/archives.html")] + ["themes/blue_centered/html/author.html" (render "themes/blue_centered/html/author.html")] + ["themes/blue_centered/html/base.html" (render "themes/blue_centered/html/base.html")] + ["themes/blue_centered/html/home.html" (render "themes/blue_centered/html/home.html")] + ["themes/blue_centered/html/page.html" (render "themes/blue_centered/html/page.html")] + ["themes/blue_centered/html/post.html" (render "themes/blue_centered/html/post.html")] + ["themes/blue_centered/html/post-content.html" (render "themes/blue_centered/html/post-content.html")] + ["themes/blue_centered/html/previews.html" (render "themes/blue_centered/html/previews.html")] + ["themes/blue_centered/html/tag.html" (render "themes/blue_centered/html/tag.html")] + ["themes/blue_centered/html/tags.html" (render "themes/blue_centered/html/tags.html")] + ["themes/blue_centered/html/404.html" (render "themes/blue_centered/html/404.html")] + ["themes/blue_centered/css/screen.css" (render "themes/blue_centered/css/screen.css")] + ["themes/blue_centered/js/highlight.pack.js" (render "themes/blue_centered/js/highlight.pack.js")]]) (def nucleus-theme - [["resources/templates/themes/nucleus/html/archives.html" (render "themes/nucleus/html/archives.html")] - ["resources/templates/themes/nucleus/html/author.html" (render "themes/nucleus/html/author.html")] - ["resources/templates/themes/nucleus/html/base.html" (render "themes/nucleus/html/base.html")] - ["resources/templates/themes/nucleus/html/home.html" (render "themes/nucleus/html/home.html")] - ["resources/templates/themes/nucleus/html/page.html" (render "themes/nucleus/html/page.html")] - ["resources/templates/themes/nucleus/html/post.html" (render "themes/nucleus/html/post.html")] - ["resources/templates/themes/nucleus/html/post-content.html" (render "themes/nucleus/html/post-content.html")] - ["resources/templates/themes/nucleus/html/previews.html" (render "themes/nucleus/html/previews.html")] - ["resources/templates/themes/nucleus/html/tag.html" (render "themes/nucleus/html/tag.html")] - ["resources/templates/themes/nucleus/html/tags.html" (render "themes/nucleus/html/tags.html")] - ["resources/templates/themes/nucleus/html/404.html" (render "themes/nucleus/html/404.html")] - ["resources/templates/themes/nucleus/js/highlight.pack.js" (render "themes/nucleus/js/highlight.pack.js")] - ["resources/templates/themes/nucleus/js/scripts.js" (render "themes/nucleus/js/scripts.js")] - ["resources/templates/themes/nucleus/css/buttons.css" (render "themes/nucleus/css/buttons.css")] - ["resources/templates/themes/nucleus/css/menu.css" (render "themes/nucleus/css/menu.css")] - ["resources/templates/themes/nucleus/css/reset.css" (render "themes/nucleus/css/reset.css")] - ["resources/templates/themes/nucleus/css/style.css" (render "themes/nucleus/css/style.css")] - ["resources/templates/themes/nucleus/css/typography.css" (render "themes/nucleus/css/typography.css")]]) + [["themes/nucleus/html/archives.html" (render "themes/nucleus/html/archives.html")] + ["themes/nucleus/html/author.html" (render "themes/nucleus/html/author.html")] + ["themes/nucleus/html/base.html" (render "themes/nucleus/html/base.html")] + ["themes/nucleus/html/home.html" (render "themes/nucleus/html/home.html")] + ["themes/nucleus/html/page.html" (render "themes/nucleus/html/page.html")] + ["themes/nucleus/html/post.html" (render "themes/nucleus/html/post.html")] + ["themes/nucleus/html/post-content.html" (render "themes/nucleus/html/post-content.html")] + ["themes/nucleus/html/previews.html" (render "themes/nucleus/html/previews.html")] + ["themes/nucleus/html/tag.html" (render "themes/nucleus/html/tag.html")] + ["themes/nucleus/html/tags.html" (render "themes/nucleus/html/tags.html")] + ["themes/nucleus/html/404.html" (render "themes/nucleus/html/404.html")] + ["themes/nucleus/js/highlight.pack.js" (render "themes/nucleus/js/highlight.pack.js")] + ["themes/nucleus/js/scripts.js" (render "themes/nucleus/js/scripts.js")] + ["themes/nucleus/css/buttons.css" (render "themes/nucleus/css/buttons.css")] + ["themes/nucleus/css/menu.css" (render "themes/nucleus/css/menu.css")] + ["themes/nucleus/css/reset.css" (render "themes/nucleus/css/reset.css")] + ["themes/nucleus/css/style.css" (render "themes/nucleus/css/style.css")] + ["themes/nucleus/css/typography.css" (render "themes/nucleus/css/typography.css")]]) (def lotus-theme - [["resources/templates/themes/lotus/config.edn" (render "themes/lotus/config.edn")] - ["resources/templates/themes/lotus/README.md" (render "themes/lotus/README.md")] - ["resources/templates/themes/lotus/css/_buttons.scss" (render "themes/lotus/css/_buttons.scss")] - ["resources/templates/themes/lotus/css/_layout.scss" (render "themes/lotus/css/_layout.scss")] - ["resources/templates/themes/lotus/css/_menu.scss" (render "themes/lotus/css/_menu.scss")] - ["resources/templates/themes/lotus/css/_typography.scss" (render "themes/lotus/css/_typography.scss")] - ["resources/templates/themes/lotus/css/_variables.scss" (render "themes/lotus/css/_variables.scss")] - ["resources/templates/themes/lotus/css/blog.scss" (render "themes/lotus/css/blog.scss")] - ["resources/templates/themes/lotus/css/lotus-highlightjs.min.css" (render "themes/lotus/css/lotus-highlightjs.min.css")] - ["resources/templates/themes/lotus/css/normalize.css" (render "themes/lotus/css/normalize.css")] - ["resources/templates/themes/lotus/html/404.html" (render "themes/lotus/html/404.html")] - ["resources/templates/themes/lotus/html/archives.html" (render "themes/lotus/html/archives.html")] - ["resources/templates/themes/lotus/html/author.html" (render "themes/lotus/html/author.html")] - ["resources/templates/themes/lotus/html/base.html" (render "themes/lotus/html/base.html")] - ["resources/templates/themes/lotus/html/home.html" (render "themes/lotus/html/home.html")] - ["resources/templates/themes/lotus/html/page.html" (render "themes/lotus/html/page.html")] - ["resources/templates/themes/lotus/html/post.html" (render "themes/lotus/html/post.html")] - ["resources/templates/themes/lotus/html/post-content.html" (render "themes/lotus/html/post-content.html")] - ["resources/templates/themes/lotus/html/prev-next.html" (render "themes/lotus/html/prev-next.html")] - ["resources/templates/themes/lotus/html/previews.html" (render "themes/lotus/html/previews.html")] - ["resources/templates/themes/lotus/html/tag.html" (render "themes/lotus/html/tag.html")] - ["resources/templates/themes/lotus/html/tags.html" (render "themes/lotus/html/tags.html")] - ["resources/templates/themes/lotus/img/black-lotus.svg" (render "themes/lotus/img/black-lotus.svg")] - ["resources/templates/themes/lotus/img/icons.svg" (render "themes/lotus/img/icons.svg")] - ["resources/templates/themes/lotus/img/white-lotus.svg" (render "themes/lotus/img/white-lotus.svg")] - ["resources/templates/themes/lotus/js/highlight.pack.js" (render "themes/lotus/js/highlight.pack.js")]]) + [["themes/lotus/config.edn" (render "themes/lotus/config.edn")] + ["themes/lotus/README.md" (render "themes/lotus/README.md")] + ["themes/lotus/css/_buttons.scss" (render "themes/lotus/css/_buttons.scss")] + ["themes/lotus/css/_layout.scss" (render "themes/lotus/css/_layout.scss")] + ["themes/lotus/css/_menu.scss" (render "themes/lotus/css/_menu.scss")] + ["themes/lotus/css/_typography.scss" (render "themes/lotus/css/_typography.scss")] + ["themes/lotus/css/_variables.scss" (render "themes/lotus/css/_variables.scss")] + ["themes/lotus/css/blog.scss" (render "themes/lotus/css/blog.scss")] + ["themes/lotus/css/lotus-highlightjs.min.css" (render "themes/lotus/css/lotus-highlightjs.min.css")] + ["themes/lotus/css/normalize.css" (render "themes/lotus/css/normalize.css")] + ["themes/lotus/html/404.html" (render "themes/lotus/html/404.html")] + ["themes/lotus/html/archives.html" (render "themes/lotus/html/archives.html")] + ["themes/lotus/html/author.html" (render "themes/lotus/html/author.html")] + ["themes/lotus/html/base.html" (render "themes/lotus/html/base.html")] + ["themes/lotus/html/home.html" (render "themes/lotus/html/home.html")] + ["themes/lotus/html/page.html" (render "themes/lotus/html/page.html")] + ["themes/lotus/html/post.html" (render "themes/lotus/html/post.html")] + ["themes/lotus/html/post-content.html" (render "themes/lotus/html/post-content.html")] + ["themes/lotus/html/prev-next.html" (render "themes/lotus/html/prev-next.html")] + ["themes/lotus/html/previews.html" (render "themes/lotus/html/previews.html")] + ["themes/lotus/html/tag.html" (render "themes/lotus/html/tag.html")] + ["themes/lotus/html/tags.html" (render "themes/lotus/html/tags.html")] + ["themes/lotus/img/black-lotus.svg" (render "themes/lotus/img/black-lotus.svg")] + ["themes/lotus/img/icons.svg" (render "themes/lotus/img/icons.svg")] + ["themes/lotus/img/white-lotus.svg" (render "themes/lotus/img/white-lotus.svg")] + ["themes/lotus/js/highlight.pack.js" (render "themes/lotus/js/highlight.pack.js")]]) (def themes (concat blue-theme @@ -111,20 +111,20 @@ [".gitignore" (render "gitignore")] ["project.clj" (render "project.clj")] ;;static resources - ["resources/templates/img/cryogen.png" (resource "img/cryogen.png")] - ["resources/templates/css/example.css" (resource "css/example.css")] - ["resources/templates/css/sassexample.scss" (resource "css/sassexample.scss")] + ["content/img/cryogen.png" (resource "img/cryogen.png")] + ["content/css/example.css" (resource "css/example.css")] + ["content/css/sassexample.scss" (resource "css/sassexample.scss")] ;;Markdown templates - ["resources/templates/md/pages/about.md" (render "md/pages/about.md")] - ["resources/templates/md/pages/another-page.md" (render "md/pages/another-page.md")] - ["resources/templates/md/posts/2014-03-10-first-post.md" (render "md/posts/2014-03-10-first-post.md")] - ["resources/templates/md/posts/2014-11-04-second-post.md" (render "md/posts/2014-11-04-second-post.md")] - ["resources/templates/md/posts/2016-01-07-docs.md" (render "md/posts/2016-01-07-docs.md")] + ["content/md/pages/about.md" (render "md/pages/about.md")] + ["content/md/pages/another-page.md" (render "md/pages/another-page.md")] + ["content/md/posts/2014-03-10-first-post.md" (render "md/posts/2014-03-10-first-post.md")] + ["content/md/posts/2014-11-04-second-post.md" (render "md/posts/2014-11-04-second-post.md")] + ["content/md/posts/2016-01-07-docs.md" (render "md/posts/2016-01-07-docs.md")] ;;Asciidoc templates - ["resources/templates/asc/pages/adoc-page.asc" (render "asc/pages/adoc-page.asc")] - ["resources/templates/asc/posts/2014-10-10-adoc-post.asc" (render "asc/posts/2014-10-10-adoc-post.asc")] + ["content/asc/pages/adoc-page.asc" (render "asc/pages/adoc-page.asc")] + ["content/asc/posts/2014-10-10-adoc-post.asc" (render "asc/posts/2014-10-10-adoc-post.asc")] ;;config - ["resources/templates/config.edn" (render "config.edn")] + ["content/config.edn" (render "config.edn")] ;;namespaces ["src/cryogen/core.clj" (render "src/cryogen/core.clj")] ["src/cryogen/server.clj" (render "src/cryogen/server.clj")] diff --git a/src/leiningen/new/cryogen/gitignore b/src/leiningen/new/cryogen/gitignore index fb01cc0..4beb681 100755 --- a/src/leiningen/new/cryogen/gitignore +++ b/src/leiningen/new/cryogen/gitignore @@ -9,4 +9,4 @@ pom.xml.asc .lein-repl-history .lein-plugins/ .lein-failures -/resources/public/ +/public/ diff --git a/src/leiningen/new/cryogen/md/posts/2016-01-07-docs.md b/src/leiningen/new/cryogen/md/posts/2016-01-07-docs.md index 956f75c..c759210 100644 --- a/src/leiningen/new/cryogen/md/posts/2016-01-07-docs.md +++ b/src/leiningen/new/cryogen/md/posts/2016-01-07-docs.md @@ -42,11 +42,11 @@ The web server can be started from the `my-blog` directory using the `lein-ring` lein ring server ``` -The server will watch for changes in the `resources/templates` folder and recompile the content automatically. +The server will watch for changes in the `content` and `themes` folders and recompile the content automatically. ### Site Configuration -The site configuration file is found at `templates/config.edn`, this file looks as follows: +The site configuration file is found at `content/config.edn`, this file looks as follows: ```clojure {:site-title "My Awesome Blog" @@ -88,25 +88,25 @@ For information about each key please see the ["Configuration"](http://cryogenwe ### Switching between Markdown and AsciiDoc Cryogen comes with Markdown support as default. If you want to use AsciiDoc instead, open the `project.clj` in your created blog (e.g. `my-blog`), and change the line in `:dependencies` that says `cryogen-markdown` to `cryogen-asciidoc`. -Instead of looking for files ending in `.md` in the `resources/templates/md` directory, the compiler will now look for files ending in `.asc` in the `resources/templates/asc` directory. +Instead of looking for files ending in `.md` in the `content/md` directory, the compiler will now look for files ending in `.asc` in the `content/asc` directory. ### Selecting a Theme -The Cryogen template comes with two themes in the `resources/templates/themes` folder. To change your blog's theme, change the value of the `:theme` key in `config.edn`. +The Cryogen template comes with two themes in the `themes` folder. To change your blog's theme, change the value of the `:theme` key in `config.edn`. ### Customizing Layouts Cryogen uses [Selmer](https://github.com/yogthos/Selmer) templating engine for layouts. Please refer to its documentation to see the supported tags and filters for the layouts. -The layouts are contained in the `resources/templates/themes/{theme}/html` folder of the project. By default, the `base.html` layout is used to provide the general layout for the site. This is where you would add static resources such as CSS and JavaScript +The layouts are contained in the `themes/{theme}/html` folder of the project. By default, the `base.html` layout is used to provide the general layout for the site. This is where you would add static resources such as CSS and JavaScript assets as well as define headers and footers for your site. Each page layout should have a name that matches the `:layout` key in the page metadata and end with `.html`. Page layouts extend the base layout and should only contain the content relevant to the page inside the `content` block. For example, the `tag` layout is located in `tag.html` and looks as follows: ```xml -{% extends "templates/html/layouts/base.html" %} +{% extends "/html/base.html" %} {% block content %}

Posts tagged {{name}}

@@ -123,9 +123,9 @@ For example, the `tag` layout is located in `tag.html` and looks as follows: ### Code Syntax Highlighting -Cryogen uses [Highlight.js](https://highlightjs.org/) for code syntax highlighting. You can add more languages by replacing `templates/js/highlight.pack.js` with a customized package from [here](https://highlightjs.org/download/). +Cryogen uses [Highlight.js](https://highlightjs.org/) for code syntax highlighting. You can add more languages by replacing `themes/{theme}/js/highlight.pack.js` with a customized package from [here](https://highlightjs.org/download/). -The ` initHighlightingOnLoad` function is called in `{theme}/html/base.html`. +The ` initHighlightingOnLoad` function is called in `themes/{theme}/html/base.html`. ```xml @@ -133,7 +133,7 @@ The ` initHighlightingOnLoad` function is called in `{theme}/html/base.html`. ## Deploying Your Site -The generated static content will be found under the `resources/public` folder. Simply copy the content to a static +The generated static content will be found under the `public` folder. Simply copy the content to a static folder for a server such as Nginx or Apache and your site is now ready for service. A sample Nginx configuration that's placed in `/etc/nginx/sites-available/default` can be seen below: diff --git a/src/leiningen/new/cryogen/src/cryogen/server.clj b/src/leiningen/new/cryogen/src/cryogen/server.clj index cee0e4e..089cd9d 100755 --- a/src/leiningen/new/cryogen/src/cryogen/server.clj +++ b/src/leiningen/new/cryogen/src/cryogen/server.clj @@ -1,23 +1,25 @@ (ns cryogen.server (:require [compojure.core :refer [GET defroutes]] [compojure.route :as route] - [ring.util.response :refer [redirect resource-response]] + [ring.util.response :refer [redirect file-response]] [ring.util.codec :refer [url-decode]] [cryogen-core.watcher :refer [start-watcher!]] [cryogen-core.plugins :refer [load-plugins]] - [cryogen-core.compiler :refer [compile-assets-timed read-config]] + [cryogen-core.compiler :refer [compile-assets-timed]] + [cryogen-core.config :refer [resolve-config]] [cryogen-core.io :refer [path]])) (defn init [] (load-plugins) (compile-assets-timed) - (let [ignored-files (-> (read-config) :ignored-files)] - (start-watcher! "resources/templates" ignored-files compile-assets-timed))) + (let [ignored-files (-> (resolve-config) :ignored-files)] + (start-watcher! "content" ignored-files compile-assets-timed) + (start-watcher! "themes" ignored-files compile-assets-timed))) (defn wrap-subdirectories [handler] (fn [request] - (let [{:keys [clean-urls blog-prefix]} (read-config) + (let [{:keys [clean-urls blog-prefix public-dest]} (resolve-config) req-uri (.substring (url-decode (:uri request)) 1) res-path (condp = clean-urls :trailing-slash (path req-uri "index.html") @@ -28,15 +30,15 @@ (path req-uri "index.html") (path (str req-uri ".html"))) :dirty (path (str req-uri ".html")))] - (or (resource-response res-path {:root "public"}) + (or (file-response res-path {:root public-dest}) (handler request))))) (defroutes routes - (GET "/" [] (redirect (let [config (read-config)] + (GET "/" [] (redirect (let [config (resolve-config)] (path (:blog-prefix config) (when (= (:clean-urls config) :dirty) "index.html"))))) - (route/resources "/") + (route/files "/") (route/not-found "Page not found")) (def handler (wrap-subdirectories routes)) diff --git a/src/leiningen/new/cryogen/themes/lotus/README.md b/src/leiningen/new/cryogen/themes/lotus/README.md index 1f00ce3..3f0ff5b 100644 --- a/src/leiningen/new/cryogen/themes/lotus/README.md +++ b/src/leiningen/new/cryogen/themes/lotus/README.md @@ -3,6 +3,6 @@ An elegant and responsive theme for Cryogen by [Matthew Davidson](https://github # Install -1. Change the `:theme` key in `resources/templates/config.edn` to "lotus". +1. Change the `:theme` key in `content/config.edn` to "lotus". 2. Replace the GitHub and LinkedIn links in `base.html` with links to your own profiles. (More social media icons can be found in `icons.svg`.) 3. Replace the white lotus logo with the logo of your choice in `base.html`. diff --git a/src/leiningen/new/cryogen/themes/lotus/config.edn b/src/leiningen/new/cryogen/themes/lotus/config.edn index 80b80fe..ffb6d96 100644 --- a/src/leiningen/new/cryogen/themes/lotus/config.edn +++ b/src/leiningen/new/cryogen/themes/lotus/config.edn @@ -1,2 +1,2 @@ -{:sass-src ["themes/lotus/css"] - :resources ["themes/lotus/img"]} +{:sass-src ["css"] + :resources ["img"]}