diff --git a/README.md b/README.md index c4f2e6af5..a28a1da8f 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,10 @@ This repository contains the source code of a static website for reading (and listening to) The Noble Quran. After the website is built, the build directory consists of HTML, CSS, JavaScript -and other static assets that can be hosted by nginx, -apache, etc. +and other static assets that can be hosted by +a web server such as nginx, apache, etc. -## Environment +## Requirements The following languages and tools have to be installed to build the website from source: @@ -40,6 +40,17 @@ kept in this repository. # Start web server rake server +## Configuration + +If you plan to host the website on your own domain +you will probably want to update +[nanoc.yaml](nanoc.yaml) +first. Largely for SEO reasons certain links will +reference the hostname al-quran.reflectslight.io. +Those links can be updated to your own domain by +changing the `server.hostname` field in +[nanoc.yaml](nanoc.yaml). + ## Thanks Alhamdulillah @@ -56,4 +67,4 @@ Alhamdulillah ## License The "source code" is released under the terms of the GPL
-See [./LICENSE](./LICENSE) for details +See [LICENSE](./LICENSE) for details diff --git a/nanoc.yaml b/nanoc.yaml index e42966f61..a1290af65 100644 --- a/nanoc.yaml +++ b/nanoc.yaml @@ -21,6 +21,7 @@ data_sources: layouts_dir: src/layouts server: + hostname: al-quran.reflectslight.io unix: path: /tmp/al-quran.reflectslight.io tcp: diff --git a/nanoc/lib/mixin.rb b/nanoc/lib/mixin.rb index 2455f5760..dc8e3c896 100644 --- a/nanoc/lib/mixin.rb +++ b/nanoc/lib/mixin.rb @@ -19,10 +19,15 @@ module Mixin end def build_dir - @build_dir ||= begin - nanoc = Ryo.from YAML.load_file(File.join(Dir.getwd, "nanoc.yaml")) - nanoc.output_dir - end + nanoc.output_dir + end + + def hostname + nanoc.server.hostname + end + + def nanoc + @nanoc ||= Ryo.from YAML.load_file(File.join(Dir.getwd, "nanoc.yaml")) end include T diff --git a/src/html/main/random.html.erb b/src/html/main/random.html.erb index 887604be4..a5d5b84f5 100644 --- a/src/html/main/random.html.erb +++ b/src/html/main/random.html.erb @@ -6,12 +6,12 @@ <%= erb("_revision.html.erb") %> <% locales.each do |locale| %> <% end %> <%= erb("_favicon.html.erb") %> diff --git a/src/html/main/redirect.html.erb b/src/html/main/redirect.html.erb index da90c0c83..340950250 100644 --- a/src/html/main/redirect.html.erb +++ b/src/html/main/redirect.html.erb @@ -6,12 +6,12 @@ <%= opengraph(Ryo(filename: "redirect.html.erb", locale: "en")) %> <% locales.each do |locale| %> <% end %> <%= erb("_favicon.html.erb") %> diff --git a/src/html/main/surah-index.html.erb b/src/html/main/surah-index.html.erb index 5e8bab33b..908e17c35 100644 --- a/src/html/main/surah-index.html.erb +++ b/src/html/main/surah-index.html.erb @@ -10,11 +10,11 @@ <%= opengraph(context) %> <% locales.each do |locale| %> <% end %> <%= erb("_favicon.html.erb") %> diff --git a/src/html/main/surah-stream.html.erb b/src/html/main/surah-stream.html.erb index 2c9c330b6..de4c9d16d 100644 --- a/src/html/main/surah-stream.html.erb +++ b/src/html/main/surah-stream.html.erb @@ -10,11 +10,11 @@ <%= opengraph(context) %> <% locales.each do |locale| %> <% end %> <%= erb("_favicon.html.erb") %> diff --git a/src/sitemap.xml.erb b/src/sitemap.xml.erb index 1e81f1961..adff134bc 100644 --- a/src/sitemap.xml.erb +++ b/src/sitemap.xml.erb @@ -3,19 +3,19 @@ xmlns:xhtml="http://www.w3.org/1999/xhtml"> <% locales.each do |locale| %> - https://al-quran.reflectslight.io/<%= locale %>/ + https://<%= hostname %>/<%= locale %>/ 1.0 weekly <% Ryo.each(name_by_id) do |_, transliterated_name| %> - https://al-quran.reflectslight.io/<%= locale %>/<%= transliterated_name %>/ + https://<%= hostname %>/<%= locale %>/<%= transliterated_name %>/ 0.8 weekly <% end %> - https://al-quran.reflectslight.io/<%= locale %>/random/ + https://<%= hostname %>/<%= locale %>/random/ 0.7 weekly