Skip to content

Commit 122a5dd

Browse files
authored
Merge pull request #196 from orionrobots/feature/tag-count-in-tag-index
Show tag counts in tag index page, clarify docker-compose usage, and update README for local/dev workflows
2 parents 1880229 + 9988625 commit 122a5dd

File tree

3 files changed

+33
-17
lines changed

3 files changed

+33
-17
lines changed

README.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,30 @@ 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 --rm dist
12+
docker compose run --interactive --rm serve npm install
13+
docker compose run --interactive --rm serve npm run dev
14+
docker compose up serve
15+
```
16+
17+
Get a bash prompt with `docker compose run --interactive serve bash`
18+
19+
## Running locally
20+
21+
You may need to determine dependencies - the docker method is preferred.
22+
823
Serve only:
924

1025
```bash
1126
npm install
1227
npm run serve
1328
```
1429

30+
## If you make changes to htaccess
31+
1532
For an experience closer to hosting, use docker compose:
1633

1734
```bash
@@ -22,13 +39,10 @@ Attaching to orionrobotsgithubio-web-1
2239
orionrobotsgithubio-web-1 | ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux-musl]
2340
```
2441

25-
## Running serve and build in docker
42+
## If you make changes to css bundle content
43+
44+
You will need to rerun the dist task:
2645

2746
```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
47+
docker compose up --rm dist
3148
```
32-
33-
Get a bash prompt with `docker compose run --interactive serve bash`
34-

docker-compose.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ services:
1313
image: node:18-bullseye
1414
command: ["rm", "-rf", "dist"]
1515

16-
web:
17-
build: _drafts/staging
18-
ports:
19-
- 8080:80
20-
volumes:
21-
- ./_site:/var/www/html
16+
# web:
17+
# build: _drafts/staging
18+
# ports:
19+
# - 8080:80
20+
# volumes:
21+
# - ./_site:/var/www/html
22+
2223
serve:
2324
image: node:18-bullseye
2425
volumes:

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 {

0 commit comments

Comments
 (0)