[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
09/09: website: Refactor GUIX_WEB_SITE_ROOT_PATH handling.
From: |
Florian Pelz |
Subject: |
09/09: website: Refactor GUIX_WEB_SITE_ROOT_PATH handling. |
Date: |
Fri, 8 Nov 2019 02:02:16 -0500 (EST) |
pelzflorian pushed a commit to branch wip-i18n
in repository guix-artwork.
commit 1318ea92395fb25a08406499fa171c9a36800cf7
Author: Florian Pelz <address@hidden>
Date: Thu Oct 31 14:52:29 2019 +0100
website: Refactor GUIX_WEB_SITE_ROOT_PATH handling.
* website/apps/base/utils.scm (guix-url): Always use guix-root-url-path.
(guix-root-url-path): Move here the logic that computes which root path to
use.
---
website/apps/base/utils.scm | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/website/apps/base/utils.scm b/website/apps/base/utils.scm
index ebb4000..8f73ee6 100644
--- a/website/apps/base/utils.scm
+++ b/website/apps/base/utils.scm
@@ -51,11 +51,17 @@
(define guix-root-url-path
;; Path to GNU Guix site at guix.gnu.org.
- (make-parameter (or (getenv "GUIX_WEB_SITE_ROOT_PATH") "/")
- (lambda (path)
- (if (string-suffix? "/" path)
- path
- (string-append path "/")))))
+ (let ((path (cond
+ ;; If we are trying out the website locally, use "/" as the
root.
+ ((getenv "GUIX_WEB_SITE_LOCAL") "/")
+ (else (or (getenv "GUIX_WEB_SITE_ROOT_PATH") "/")))))
+ (make-parameter
+ path
+ ;; When setting guix-root-url-path, make it end in a slash.
+ (lambda (path)
+ (if (string-suffix? "/" path)
+ path
+ (string-append path "/"))))))
(define latest-guix-version
(make-parameter "1.0.1"))
@@ -108,16 +114,13 @@
For example: 'packages/icecat-XYZ/'.
LOCALIZE (boolean)
- Whether to call localize-url on the URL path.
+ Whether to prepend the result of 'localized-root-path' to the URL path.
RETURN VALUE (string)
A URL path. For example: /software/guix/packages/icecat-XYZ/."
- ((if localize localize-url identity)
- ;; If we are trying out the website locally, use "/" as the root.
- ;; Otherwise use guix-root-url-path for deployment to gnu.org.
- (if (getenv "GUIX_WEB_SITE_LOCAL")
- (string-append "/" subpath)
- (string-append (guix-root-url-path) subpath))))
+ (string-append (guix-root-url-path)
+ (if localize (localized-root-path subpath) "")
+ subpath))
(define* (manual-url #:optional (subpath "")
- branch wip-i18n created (now 1318ea9), Florian Pelz, 2019/11/08
- 03/09: website: media: Do not localize video page URLs., Florian Pelz, 2019/11/08
- 05/09: website: navbar: Make dropdowns accessible to keyboard and touch input., Florian Pelz, 2019/11/08
- 08/09: website: Fix building with GUIX_WEB_SITE_ROOT_PATH., Florian Pelz, 2019/11/08
- 06/09: website: Add language selection dropdown to navbar., Florian Pelz, 2019/11/08
- 09/09: website: Refactor GUIX_WEB_SITE_ROOT_PATH handling.,
Florian Pelz <=
- 07/09: website: Handle GUIX_WEB_SITE_ROOT_PATH not ending in a slash., Florian Pelz, 2019/11/08
- 01/09: website: Add custom xgettext to extract from nested sexps for i18n., Florian Pelz, 2019/11/08
- 04/09: website: nls: Add German translation., Florian Pelz, 2019/11/08
- 02/09: website: apps: Mark all files for translation., Florian Pelz, 2019/11/08