Skip to content

Commit 5478f18

Browse files
authored
Merge branch 'master' into dependabot/npm_and_yarn/11ty/eleventy-img-6.0.4
2 parents ae44aa4 + d199d22 commit 5478f18

File tree

5 files changed

+63
-23
lines changed

5 files changed

+63
-23
lines changed

README.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,29 @@ Orionrobots website source
55
CC BY SA 3.0 - <http://creativecommons.org/licenses/by-sa/3.0/>
66
Creative 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+
822
Serve only:
923

1024
```bash
1125
npm install
1226
npm run serve
1327
```
1428

29+
## If you make changes to htaccess
30+
1531
For an experience closer to hosting, use docker compose:
1632

1733
```bash
@@ -22,13 +38,10 @@ Attaching to orionrobotsgithubio-web-1
2238
orionrobotsgithubio-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-

docker-compose.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,34 @@
11
services:
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

navigation_and_indexes/tag_index.11ty.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
const 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

89
function 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

1314
class TagIndex {

serve.Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM node:18-bullseye
2+
# Install dependencies
3+
RUN npm install
4+

src/shortcodes/make_tab_gallery.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff 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>';

0 commit comments

Comments
 (0)