diff --git a/gatsby/lobid/gatsby-node.js b/gatsby/lobid/gatsby-node.js index fe97acae..4352215e 100644 --- a/gatsby/lobid/gatsby-node.js +++ b/gatsby/lobid/gatsby-node.js @@ -42,6 +42,7 @@ exports.createPages = async ({ graphql, actions }) => { const shortMemberIds = members.membership.map(m => m.member.id) .filter(id => id.indexOf("lobid.org/team") != -1) .map(id => id.slice(id.lastIndexOf("/") + 1, id.lastIndexOf("!#") - 1)); + console.log("Creating member pages: ", shortMemberIds); addPages(shortMemberIds, "team", "./src/templates/member.js", createPage); // Pages for individual products listed in `makesOffer` @@ -60,7 +61,8 @@ exports.createPages = async ({ graphql, actions }) => { const shortProductIds = products.makesOffer.map(p => p.id) .filter(id => id.indexOf("/") != -1) - .map(id => id.slice(id.lastIndexOf("/") + 1, id.lastIndexOf("."))); + .map(id => id.slice(id.lastIndexOf("/") + 1)); + console.log("Creating product pages: ", shortProductIds); addPages(shortProductIds, "product", "./src/templates/product.js", createPage); // Pages for individual project files in /project @@ -78,10 +80,11 @@ exports.createPages = async ({ graphql, actions }) => { } } `); - + const shortProjectIds = projects.edges.map(e => e.node.id) .filter(id => id.indexOf("/") != -1) .map(id => id.slice(id.lastIndexOf("/") + 1)); + console.log("Creating project pages: ", shortProjectIds); addPages(shortProjectIds, "project", "./src/templates/project.js", createPage); }; diff --git a/gatsby/lobid/src/components/helpers.js b/gatsby/lobid/src/components/helpers.js index 158c7ea3..08343d0c 100644 --- a/gatsby/lobid/src/components/helpers.js +++ b/gatsby/lobid/src/components/helpers.js @@ -1,7 +1,3 @@ -export function simpleProductId(url) { - return url.slice(url.lastIndexOf("/") + 1, url.lastIndexOf(".")); -} - -export function simpleProjectId(url) { - return url.slice(url.lastIndexOf('/')+1); +export function simpleId(url) { + return url.slice(url.lastIndexOf("/") + 1); } diff --git a/gatsby/lobid/src/components/product.html.js b/gatsby/lobid/src/components/product.html.js index d75dbe0e..3df1f419 100644 --- a/gatsby/lobid/src/components/product.html.js +++ b/gatsby/lobid/src/components/product.html.js @@ -1,6 +1,6 @@ import React from "react"; import md5 from 'md5'; -import { simpleProductId } from './helpers.js' +import { simpleId } from './helpers.js' import Header from "./header.html"; import Footer from "./footer.html"; @@ -20,9 +20,10 @@ export class Product extends React.Component { } asLinks(field) { - return this.props.product[field] &&
{this.props.product.description.label}
+{this.props.product.description.label}
Website | {this.props.product.id} |
Website | {this.props.product.url || this.props.product.id} |
{this.props[field]} | {this.props.project[field].map((link) => - + return this.props.project[field] && |
{this.props[field]} | {this.props.project[field].map((link) => { + let linkId = link.id.replace(/https?:\/\/lobid.org\//, '/'); + return + } )} |
Website | {this.props.project.id} |
Website | {this.props.project.url || this.props.project.id} |
Abgeschlossen | {this.props.project.endDate} | {publication.datePublished} | {publication.name.de || publication.name.en || publication.id} | {publication.about && publication.about.map(a =>
-
+ {a.id.slice(a.id.lastIndexOf("/")+1, a.id.lastIndexOf("."))} )} |
{publication.type} | diff --git a/gatsby/lobid/src/components/team.html.js b/gatsby/lobid/src/components/team.html.js index cc62096b..ac342e62 100644 --- a/gatsby/lobid/src/components/team.html.js +++ b/gatsby/lobid/src/components/team.html.js @@ -1,6 +1,6 @@ import React from "react"; import md5 from 'md5'; -import { simpleProductId, simpleProjectId } from './helpers.js' +import { simpleId } from './helpers.js' import Header from "./header.html"; import Footer from "./footer.html"; @@ -172,7 +172,7 @@ export class Team extends React.Component { |