practicalli / blog-cryogen

Cryogen powered blog with all the content used to generate the static website.
https://practical.li/blog-cryogen/
3 stars 2 forks source link

Blogging with Cryogen - deployment to GitHub #49

Open practicalli-johnny opened 4 years ago

practicalli-johnny commented 4 years ago

discuss my hacky script for deploying a cryogen site to GitHub pages

Also show how easy it is to create a second repository and use that as a test / review environment. All that was needed was to create the additional repository and copy the hacky deployment script, change its name and update it with the new github repo url.

If you are using GitHub project repositories for your blog (rather than user or org), then you need to set the cryogen :blog-prefix key in the content/config.edn file. This causes a problem for test, as it would need a different prefix value, eg blog for live and test-blog for production. It you are using a preview page as the main page of the blog, then the test-blog links will go to the live site, unless you change the :blog-prefix value.

Posted on slack https://clojurians.slack.com/archives/C0M8UK760/p1579438332012900 https://clojurians.slack.com/archives/C0M8UK760/p1579439575016500 https://clojurians.slack.com/archives/C0M8UK760/p1579439678018100 I would like to generate a site with :blog-prefix set to either /blog or /test-blog , depending on whether I am generating the static site for the live website or the test environment. This setting affects the Continue Reading links on the main page when :preview? true is set.Is it possible to use a different content/config.edn when calling lein run to generate the static site? For example, having a content/config-test.edn to configure the test environment?I am using GitHub project (not user or org, they are already used) to host a cryogen blog and everything works great for one environment. I created a second GitHub repository and deployment works, but the continue reading links on the main page either go to the live website or get a 404 if the article is only on the test site.I am looking at the http://cryogenweb.org/docs/configuration.html section for ideas, but there isnt an obvious (to me) way of doing this, without investigating the Cryogen source code more deeply. Am I missing something obvious? (edited) practicalli:speech_bubble: 13:12 I found a solution. If I add a config-file argument to the -main function in src/cryogen/core.clj and use that a a way of specifying an overrides file, then I can call lein run content/config-test.edn or lein run content/config.edn depending on if I want the test site or live site.

(defn -main [config-file] (load-plugins) (compile-assets-timed (read-string (slurp config-file))) (System/exit 0))

13:14 I am assuming the src/cryogen/server.clj is used by the command lein ring server and not lein run and so I wont need to change that file as I always want that to be using just the content/config.edn file.

Simples.