File tree Expand file tree Collapse file tree 5 files changed +63
-23
lines changed Expand file tree Collapse file tree 5 files changed +63
-23
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,29 @@ Orionrobots website source
55CC BY SA 3.0 - < http://creativecommons.org/licenses/by-sa/3.0/ >
66Creative Commons By Attribution Share-Alike v3.0
77
8+ ## Running serve and build in docker
9+
10+ ``` bash
11+ docker compose up dist
12+ docker compose run --interactive --rm serve npm run dev
13+ docker compose up serve
14+ ```
15+
16+ Get a bash prompt with ` docker compose run --interactive serve bash `
17+
18+ ## Running locally
19+
20+ You may need to determine dependencies - the docker method is preferred.
21+
822Serve only:
923
1024``` bash
1125npm install
1226npm run serve
1327```
1428
29+ ## If you make changes to htaccess
30+
1531For an experience closer to hosting, use docker compose:
1632
1733``` bash
@@ -22,13 +38,10 @@ Attaching to orionrobotsgithubio-web-1
2238orionrobotsgithubio-web-1 | ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux-musl]
2339```
2440
25- ## Running serve and build in docker
41+ ## If you make changes to css bundle content
42+
43+ You will need to rerun the dist task:
2644
2745``` bash
28- docker compose run --interactive --rm serve npm install
29- docker compose run --interactive --rm serve npm run dev
30- docker compose up serve
46+ docker compose up --rm dist
3147```
32-
33- Get a bash prompt with ` docker compose run --interactive serve bash `
34-
Original file line number Diff line number Diff line change 11services :
22 dist :
3- image : node:18-bullseye
3+ build :
4+ context : .
5+ dockerfile : Dockerfile.dist
46 command : ["npm", "run", "dist"]
57 volumes :
68 - .:/src
79 working_dir : /src
810
911 dist_clean :
12+ build :
13+ context : .
14+ dockerfile : Dockerfile.dist
1015 volumes :
1116 - .:/src
1217 working_dir : /src
1318 image : node:18-bullseye
1419 command : ["rm", "-rf", "dist"]
1520
16- web :
17- build : _drafts/staging
18- ports :
19- - 8080:80
20- volumes :
21- - ./_site:/var/www/html
21+ # web:
22+ # build: _drafts/staging
23+ # ports:
24+ # - 8080:80
25+ # volumes:
26+ # - ./_site:/var/www/html
27+
2228 serve :
23- image : node:18-bullseye
29+ build :
30+ context : .
31+ dockerfile : Dockerfile.dist
2432 volumes :
2533 - .:/src
2634 working_dir : /src
Original file line number Diff line number Diff line change 11const slugify = require ( "slugify" ) ;
22
3- function tag_item ( tag_name ) {
4- tag_slug = slugify ( tag_name ) ;
5- return `<li><a href="/tags/${ tag_slug } ">${ tag_name } </a></li>` ;
3+ function tag_item ( tag_name , tags ) {
4+ const tag_slug = slugify ( tag_name ) ;
5+ const count = tags [ tag_name ] ?. length || 0 ;
6+ return `<li><a href="/tags/${ tag_slug } ">${ tag_name } <span class="badge tag-badge rounded-pill">${ count } </span></a></li>` ;
67}
78
89function tag_list ( tags ) {
910 const keys = Object . keys ( tags ) . sort ( ) ;
10- return `<ul>${ keys . map ( tag_item ) . join ( "" ) } </ul>` ;
11+ return `<ul>${ keys . map ( tag => tag_item ( tag , tags ) ) . join ( "" ) } </ul>` ;
1112}
1213
1314class TagIndex {
Original file line number Diff line number Diff line change 1+ FROM node:18-bullseye
2+ # Install dependencies
3+ RUN npm install
4+
Original file line number Diff line number Diff line change @@ -49,10 +49,24 @@ async function make_gallery(id, images) {
4949 const description_element = '<div class="image-tab-gallery-description row"></div>' ;
5050 const current_image_element = '<div class="image-tab-gallery-current-image col-md-5"></div>' ;
5151
52- const tabs = images_with_metadata . map (
53- image => '<div class="image-tab-gallery-tab" title="' + image . alt + '" data-src="' + image . metadata . jpeg [ 0 ] . url + '">' +
54- '<img src="' + image . thumb_metadata . jpeg [ 1 ] . url + '" loading="lazy" decoding="async" width="128" height="112" alt="' + image . alt + '">' +
55- '</div>' ) ;
52+ const tabs = images_with_metadata . map ( image => {
53+ let thumbnailUrl = '' ;
54+ let mainImageUrl = '' ;
55+ const thumbnailAlt = image . alt || '' ;
56+ if ( image . thumb_metadata ?. jpeg ?. [ 1 ] ?. url ) {
57+ thumbnailUrl = image . thumb_metadata . jpeg [ 1 ] . url ;
58+ } else {
59+ console . warn ( `Tab Gallery: Missing thumbnail for image alt='${ thumbnailAlt } '. Falling back to empty src.` ) ;
60+ }
61+ if ( image . metadata ?. jpeg ?. [ 0 ] ?. url ) {
62+ mainImageUrl = image . metadata . jpeg [ 0 ] . url ;
63+ } else {
64+ console . warn ( `Tab Gallery: Missing main image for image alt='${ thumbnailAlt } '. Falling back to empty src.` ) ;
65+ }
66+ return '<div class="image-tab-gallery-tab" title="' + thumbnailAlt + '" data-src="' + mainImageUrl + '">' +
67+ '<img src="' + thumbnailUrl + '" loading="lazy" decoding="async" width="128" height="112" alt="' + thumbnailAlt + '">' +
68+ '</div>' ;
69+ } ) ;
5670 // put the joined tabs in the tabs element.
5771
5872 const tabs_element = '<div class="image-tab-gallery-tabs col-md-3">' + tabs . join ( "\n" ) + '</div>' ;
You can’t perform that action at this time.
0 commit comments