diff --git a/.github/workflows/build-site.yml b/.github/workflows/build-site.yml index 21432863..98d06131 100644 --- a/.github/workflows/build-site.yml +++ b/.github/workflows/build-site.yml @@ -48,6 +48,7 @@ jobs: run: | . nikola/bin/activate nikola build + python utils/check_documentation_urls.py output - name: Pack output run: | diff --git a/README.md b/README.md index 188f4992..227d0821 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,8 @@ If, on osx, you receive this error: `FileNotFoundError: [Errno 2] No such file o **./serve.sh** : Starts a local web server that serves the site and opens it in the browser. +Builds default to `https://openframeworks.cc/` for absolute links. For a local preview with localhost URLs, explicitly set `OFSITE_SITE_URL=http://localhost:8000/` when running `nikola build`. Production builds must use the public URL. + If you plan to do a big modifications like contribute a translation the easiest is to leave the 2 last scripts running and just edit the content files and the site will automatically get refreshed. ## Documentation-style markdown diff --git a/build_server.sh b/build_server.sh index 9e701fb8..157720de 100755 --- a/build_server.sh +++ b/build_server.sh @@ -61,8 +61,12 @@ if [ -z "$SRC" ]; then echo nikola . nikola/bin/activate #nikola clean 2>> $LOG - nikola build 2>> $LOG + OFSITE_SITE_URL=https://openframeworks.cc/ nikola build 2>> $LOG ret=$? + if [ "$ret" -eq 0 ]; then + python utils/check_documentation_urls.py output 2>> $LOG + ret=$? + fi if [ $ret -ne 0 ] then SUBJECT="Failed building site" diff --git a/conf.py b/conf.py index 3bdca6eb..63a6b8b5 100644 --- a/conf.py +++ b/conf.py @@ -4,7 +4,7 @@ import os import time import markdown -import socket +import hashlib # !! This is the configuration of Nikola. !! # # !! You should edit it to your liking. !! # @@ -24,12 +24,7 @@ BLOG_TITLE = "openFrameworks" # (translatable) # This is the main URL for your site. It will be used # in a prominent link. Don't forget the protocol (http/https)! -if os.environ.get("OFSITE_SITE_URL"): - SITE_URL = os.environ["OFSITE_SITE_URL"] -elif socket.gethostbyname(socket.gethostname()) == socket.gethostbyname('openframeworks.cc'): - SITE_URL = "https://openframeworks.cc/" -else: - SITE_URL = "http://localhost:8000/" +SITE_URL = os.environ.get("OFSITE_SITE_URL") or "https://openframeworks.cc/" # This is the URL where Nikola's output will be deployed. # If not set, defaults to SITE_URL # BASE_URL = "http://openframeworks.cc/" @@ -1249,7 +1244,11 @@ # Put in global_context things you want available on all your templates. # It can be anything, data, functions, modules, etc. +with open(os.path.join(os.path.dirname(__file__), "themes/openframeworks/assets/css/style.css"), "rb") as _stylesheet: + STYLESHEET_VERSION = hashlib.sha256(_stylesheet.read()).hexdigest()[:12] + GLOBAL_CONTEXT = { + "stylesheet_version": STYLESHEET_VERSION, "currentVersion": "0.12.1", "breaking": False, "majorVersion": "0.12.1", diff --git a/themes/openframeworks/assets/css/style.css b/themes/openframeworks/assets/css/style.css index cf237ff9..491a9ece 100644 --- a/themes/openframeworks/assets/css/style.css +++ b/themes/openframeworks/assets/css/style.css @@ -1670,21 +1670,26 @@ table.tableblock #preamble>.sectionbody>.paragraph:first-of-type p{font-size:inh /* Download platform groups. */ .download-platform-group { clear: both; - background: #eee; - border: 1px solid #ddd; - padding: 24px; - margin: 0 0 20px; + margin: 0 0 30px; box-sizing: border-box; } -.download-platform-group > h2 { margin-top: 0; } +.download-platform-group > h2 { margin: 0 0 16px; } .download-platform-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); - gap: 24px; + gap: 16px; } .download-platform-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .download-platform-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } -.download-platform { min-width: 0; overflow-wrap: anywhere; } +.download-platform { + min-width: 0; + padding: 20px; + background: #eee; + border: 1px solid #ddd; + box-sizing: border-box; + overflow-wrap: anywhere; +} +.download-platform > h3 { margin-top: 0; } .download-platform p { margin: 0 0 10px; } .download-target-note { font-size: 0.9em; margin-bottom: 0; } .download-nightly { clear: both; padding-top: 12px; } diff --git a/themes/openframeworks/templates/base.tmpl b/themes/openframeworks/templates/base.tmpl index 16d13d45..86427cea 100644 --- a/themes/openframeworks/templates/base.tmpl +++ b/themes/openframeworks/templates/base.tmpl @@ -52,7 +52,7 @@ ${set_locale(lang)} - + diff --git a/themes/openframeworks/templates/documentation_index_block.mako b/themes/openframeworks/templates/documentation_index_block.mako index 72c60b4e..9b07147d 100644 --- a/themes/openframeworks/templates/documentation_index_block.mako +++ b/themes/openframeworks/templates/documentation_index_block.mako @@ -1,5 +1,9 @@ ## -*- coding: utf-8 -*- <%page args="module,classes,show_header,subtitle"/> +<% + language_path = translations[lang].strip("./") + documentation_path = ("/" + language_path if language_path else "") + "/documentation/" + module +%>