Skip to content

Commit

Permalink
Moved draft and latest to the top of catalog listings and removed the…
Browse files Browse the repository at this point in the history
… slash from the catalog header names. Fixes #17 and #33
  • Loading branch information
bherr2 committed Jan 10, 2025
1 parent 34a20d4 commit 5b987ad
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
13 changes: 11 additions & 2 deletions src/finalizing/create-catalogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,24 @@ export function createCatalogs(context) {

for (const doName of doNames.sort()) {
const versions = catalog[doType][doName];
createListing(context, `${doType}/${doName}`, versions, 'Dataset');
createListing(context, `${doType}/${doName}`, sortVersions(versions), 'Dataset');
}
}
}

function sortVersions(versions) {
return [
versions.find((n) => n === 'latest'),
versions.find((n) => n === 'draft'),
...versions.filter((n) => n !== 'latest' && n !== 'draft'),
].filter((n) => !!n);
}

function createListing(context, path, items, itemType) {
const iri = `${context.lodIri}${path ? path + '/' : path}`;
const noSlashIri = `${context.lodIri}${path ? path + '/' : path}`;
const lodIri = context.lodIri;
writeIndexHtml(context, path, { iri, items, itemType, lodIri });
writeIndexHtml(context, path, { iri, items, itemType, lodIri, noSlashIri });
reifyCatalog(context, iri, path);
}

Expand Down
2 changes: 1 addition & 1 deletion src/finalizing/templates/catalog-html.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/png" href="https://humanatlas.io/favicon.png" />

<title>Catalog for {{ iri }}</title>
<title>Catalog for {{ noSlashIri }}</title>
<base href="{{ iri }}">

<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet" />
Expand Down
6 changes: 3 additions & 3 deletions src/finalizing/templates/readme-md.njk
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@

<h3 id="raw-data">Source Data</h3>

**Title:**
**Title:**
{{ was_derived_from.title }}

**Description:**
{{ was_derived_from.description }}

**Creator(s):**
**Creator(s):**
{% for person in was_derived_from.creators %}
* [{{ person.fullName }}]({{ person.id }})
{% endfor %}
Expand All @@ -57,7 +57,7 @@
* [{{ person.fullName }}]({{ person.id }})
{% endfor %}

**Reviewer(s):**
**Reviewer(s):**
{% for person in was_derived_from.reviewers %}
* [{{ person.fullName }}]({{ person.id }})
{% endfor %}
Expand Down

0 comments on commit 5b987ad

Please sign in to comment.