diff --git a/package.json b/package.json index c38a51d94c..ac36371a5c 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "scripts": { "federalist": "export NODE_ENV=production && gulp buildAssets", "hugo": "export $(grep -v '^#' .env | xargs) && hugo serve --bind='0.0.0.0'", + "hugo-no-livereload": "export $(grep -v '^#' .env | xargs) && hugo serve --bind='0.0.0.0' --disableLiveReload", "lint:json": "find public/**/v1/json/index.html -print0 | xargs -0I {} jsonlint '{}'", "lint:js": "eslint './themes/digital.gov/src/js/*.js' './config/typescript/**/*.ts'", "lint:js:fix": "eslint --fix './themes/digital.gov/src/js/*.js' './config/typescript/**/*.ts'", diff --git a/start.sh b/start.sh new file mode 100755 index 0000000000..1aefab74f9 --- /dev/null +++ b/start.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +npm run hugo diff --git a/start_migrate.sh b/start_migrate.sh new file mode 100755 index 0000000000..9092781052 --- /dev/null +++ b/start_migrate.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +npm run hugo-no-livereload \ No newline at end of file diff --git a/themes/digital.gov/layouts/shortcodes/api-images.html b/themes/digital.gov/layouts/shortcodes/api-images.html index e05f73e003..26ad5ea35a 100644 --- a/themes/digital.gov/layouts/shortcodes/api-images.html +++ b/themes/digital.gov/layouts/shortcodes/api-images.html @@ -1,5 +1,20 @@ {{- $.Scratch.Add "index" slice -}} {{- range $image := sort $.Site.Data.images ".date" "desc" -}} - {{- $.Scratch.Add "index" (dict "uid" $image.uid "date" $image.date "height" $image.height "width" $image.width "format" $image.format "alt" ($image.alt | default "" | plainify) "caption" ($image.caption | default "" | plainify) "credit" ($image.credit | default "" | plainify)) -}} + + {{- if (and .uid $image.format) }} + {{- $sourceURL := printf "https://s3.amazonaws.com/digitalgov/%s.%s" $image.uid $image.format -}} + {{- $.Scratch.Add "index" (dict + "uid" $image.uid + "date" $image.date + "height" $image.height + "width" $image.width + "format" $image.format + "alt" ($image.alt | default "" | plainify) + "caption" ($image.caption | default "" | plainify) + "credit" ($image.credit | default "" | plainify) + "source-url" $sourceURL + ) + -}} + {{- end }} {{- end -}} {{- $.Scratch.Get "index" | jsonify -}}