diff --git a/nix/site.nix b/nix/site.nix index c5950b1..b9778ec 100644 --- a/nix/site.nix +++ b/nix/site.nix @@ -1,5 +1,10 @@ { pkgs }: +let + stylesheetHash = builtins.substring 0 12 (builtins.hashFile "sha256" ../site/styles.css); + stylesheetFileName = "styles-${stylesheetHash}.css"; +in + pkgs.stdenvNoCC.mkDerivation { pname = "tide-landing-page"; version = "1.0.0"; @@ -12,6 +17,11 @@ pkgs.stdenvNoCC.mkDerivation { mkdir -p "$out" cp -R . "$out" + mv "$out/styles.css" "$out/${stylesheetFileName}" + substituteInPlace "$out/index.html" \ + --replace-fail \ + 'href="/styles.css"' \ + 'href="/${stylesheetFileName}"' runHook postInstall ''; diff --git a/nix/tests/module.nix b/nix/tests/module.nix index b3de3b3..2ef0f3a 100644 --- a/nix/tests/module.nix +++ b/nix/tests/module.nix @@ -25,6 +25,8 @@ let }; evaluatedConfig = evaluatedSystem.config; landingPage = self.packages.${system}.landing-page; + stylesheetHash = builtins.substring 0 12 (builtins.hashFile "sha256" ../../site/styles.css); + stylesheetFileName = "styles-${stylesheetHash}.css"; landingVirtualHost = evaluatedConfig.services.nginx.virtualHosts."torahimderecheretz.com"; discourseConfig = evaluatedConfig.services.discourse; backupConfig = evaluatedConfig.services.borgbackup.jobs.discourse; @@ -62,10 +64,41 @@ assert !(evaluatedConfig.services.nginx.virtualHosts ? "tide.yisroelbaum.com"); assert !(evaluatedConfig.services.nginx.virtualHosts ? "apitide.yisroelbaum.com"); pkgs.runCommand "tide-module-test" { } '' test -f ${landingPage}/index.html - test -f ${landingPage}/styles.css + test -f ${landingPage}/${stylesheetFileName} + test ! -e ${landingPage}/styles.css test -f ${landingPage}/robots.txt - test -f ${landingPage}/assets/rav-hirsch-1847.jpg - test -f ${landingPage}/assets/rav-hirsch-1847.webp + test -f ${landingPage}/assets/rav-hirsch-later-life.jpg + test -f ${landingPage}/assets/rav-hirsch-later-life.webp + test -f ${landingPage}/assets/social-preview-hirsch-later-life.png + test ! -e ${landingPage}/assets/rav-hirsch-1847.jpg + test ! -e ${landingPage}/assets/rav-hirsch-1847.webp + ${pkgs.diffutils}/bin/cmp \ + ${../../site/styles.css} \ + ${landingPage}/${stylesheetFileName} + ${pkgs.gnugrep}/bin/grep -F \ + 'aspect-ratio: 5 / 6;' \ + ${landingPage}/${stylesheetFileName} + ${pkgs.gnugrep}/bin/grep -F \ + 'href="/${stylesheetFileName}"' \ + ${landingPage}/index.html + ${pkgs.gnugrep}/bin/grep -F \ + 'href="/assets/rav-hirsch-later-life.webp"' \ + ${landingPage}/index.html + ${pkgs.gnugrep}/bin/grep -F \ + 'src="/assets/rav-hirsch-later-life.jpg"' \ + ${landingPage}/index.html + ${pkgs.gnugrep}/bin/grep -F \ + 'height="600"' \ + ${landingPage}/index.html + ${pkgs.gnugrep}/bin/grep -F \ + 'assets/social-preview-hirsch-later-life.png' \ + ${landingPage}/index.html + if ${pkgs.gnugrep}/bin/grep -F \ + 'href="/styles.css"' \ + ${landingPage}/index.html; then + echo "unexpected unversioned stylesheet reference" >&2 + exit 1 + fi ${pkgs.gnugrep}/bin/grep -F \ "A Torah vision for the whole of life." \ ${landingPage}/index.html diff --git a/site/assets/rav-hirsch-1847.jpg b/site/assets/rav-hirsch-1847.jpg deleted file mode 100644 index 0fd136a..0000000 Binary files a/site/assets/rav-hirsch-1847.jpg and /dev/null differ diff --git a/site/assets/rav-hirsch-1847.webp b/site/assets/rav-hirsch-1847.webp deleted file mode 100644 index 4b0f701..0000000 Binary files a/site/assets/rav-hirsch-1847.webp and /dev/null differ diff --git a/site/assets/rav-hirsch-later-life.jpg b/site/assets/rav-hirsch-later-life.jpg new file mode 100644 index 0000000..d2f8391 Binary files /dev/null and b/site/assets/rav-hirsch-later-life.jpg differ diff --git a/site/assets/rav-hirsch-later-life.webp b/site/assets/rav-hirsch-later-life.webp new file mode 100644 index 0000000..2b194f6 Binary files /dev/null and b/site/assets/rav-hirsch-later-life.webp differ diff --git a/site/assets/social-preview-hirsch-later-life.png b/site/assets/social-preview-hirsch-later-life.png new file mode 100644 index 0000000..79630ca Binary files /dev/null and b/site/assets/social-preview-hirsch-later-life.png differ diff --git a/site/assets/social-preview.png b/site/assets/social-preview.png deleted file mode 100644 index 8765eb2..0000000 Binary files a/site/assets/social-preview.png and /dev/null differ diff --git a/site/assets/social-preview.svg b/site/assets/social-preview.svg index 862b588..dc1c424 100644 --- a/site/assets/social-preview.svg +++ b/site/assets/social-preview.svg @@ -19,12 +19,12 @@ diff --git a/site/index.html b/site/index.html index e85405b..5972984 100644 --- a/site/index.html +++ b/site/index.html @@ -21,11 +21,11 @@ @@ -46,7 +46,7 @@ > @@ -112,14 +112,14 @@
Lithographic portrait of Rav Samson Raphael Hirsch as a young man 1808 · 1888 @@ -311,10 +311,11 @@ diff --git a/site/styles.css b/site/styles.css index 8091b09..7df6ead 100644 --- a/site/styles.css +++ b/site/styles.css @@ -398,7 +398,7 @@ cite { .portrait img { width: 100%; - aspect-ratio: 0.955; + aspect-ratio: 5 / 6; background: #d7cec1; filter: sepia(0.12) contrast(1.04); object-fit: cover;