diff --git a/cypress/e2e/head.cy.js b/cypress/e2e/head.cy.js
new file mode 100644
index 0000000..2695be3
--- /dev/null
+++ b/cypress/e2e/head.cy.js
@@ -0,0 +1,15 @@
+describe("Concept Scheme has correct head tags", () => {
+ it("has correct title", () => {
+ cy.visit("/w3id.org/index.html", {
+ onBeforeLoad(win) {
+ Object.defineProperty(win.navigator, "language", { value: "de-DE" })
+ },
+ })
+ cy.title().should("eq", "Test Vokabular | SkoHub Vocabs")
+ cy.get(`head > meta[name="keywords"]`).should(
+ "have.attr",
+ "content",
+ "Concept, Test Vokabular"
+ )
+ })
+})
diff --git a/src/components/Concept.jsx b/src/components/Concept.jsx
index b148571..e2522fd 100644
--- a/src/components/Concept.jsx
+++ b/src/components/Concept.jsx
@@ -13,6 +13,9 @@ const Concept = ({
const { config, conceptSchemes } = getConfigAndConceptSchemes()
const { data } = useSkoHubContext()
const [language, setLanguage] = useState("")
+ const definition =
+ concept?.definition || concept?.description || concept?.dcdescription
+ const title = concept?.prefLabel || concept?.title || concept?.dctitle
useEffect(() => {
setLanguage(data.selectedLanguage)
@@ -25,8 +28,7 @@ const Concept = ({
{concept.notation && {concept.notation.join(",")} }
- {(concept?.prefLabel && i18n(language)(concept.prefLabel)) ||
- (concept?.title && i18n(language)(concept.title))}
+ {title && i18n(language)(title)}
@@ -44,11 +46,11 @@ const Concept = ({
)}
- {concept.definition && (
+ {definition && (
Definition
- {i18n(language)(concept.definition) ||
+ {i18n(language)(definition) ||
`*No definition in language "${language}" provided.*`}
diff --git a/src/components/ConceptScheme.jsx b/src/components/ConceptScheme.jsx
index 8029cb4..76ebf33 100644
--- a/src/components/ConceptScheme.jsx
+++ b/src/components/ConceptScheme.jsx
@@ -17,30 +17,27 @@ const ConceptScheme = ({
}, [data?.selectedLanguage])
const pathname = useLocation()
-
+ const description = conceptScheme?.description || conceptScheme?.dcdescription
+ const title =
+ conceptScheme?.title || conceptScheme?.dctitle || conceptScheme?.prefLabel
// got some hash uri to show
if (pathname.hash) {
- const filtered = embed.filter((c) => c.json.id.endsWith(pathname.hash))
+ const filtered = embed.find((c) => c.json.id.endsWith(pathname.hash))
return (
-
+
)
} else {
return (
-
- {(conceptScheme?.title && i18n(language)(conceptScheme.title)) ||
- (conceptScheme?.prefLabel &&
- i18n(language)(conceptScheme.prefLabel)) ||
- (conceptScheme?.dctitle && i18n(language)(conceptScheme.dctitle))}
-
+
{title && i18n(language)(title)}
- {conceptScheme.description && (
+ {description && (
- {i18n(language)(conceptScheme.description)}
+ {i18n(language)(description)}
)}
diff --git a/src/context.js b/src/context.js
index 50829d6..ad93f9b 100644
--- a/src/context.js
+++ b/src/context.js
@@ -18,6 +18,10 @@ const jsonld = {
"@id": "http://purl.org/dc/elements/1.1/title",
"@container": "@language",
},
+ dcdescription: {
+ "@id": "http://purl.org/dc/elements/1.1/description",
+ "@container": "@language",
+ },
description: {
"@id": "dct:description",
"@container": "@language",
diff --git a/src/queries.js b/src/queries.js
index 7fe8b12..01fc881 100644
--- a/src/queries.js
+++ b/src/queries.js
@@ -157,6 +157,9 @@ module.exports.allConceptScheme = (languages) => `
description {
${[...languages].join(" ")}
}
+ dcdescription {
+ ${[...languages].join(" ")}
+ }
hasTopConcept {
...ConceptFields
narrower {
diff --git a/src/templates/App.jsx b/src/templates/App.jsx
index b9a6c93..f30936d 100644
--- a/src/templates/App.jsx
+++ b/src/templates/App.jsx
@@ -160,19 +160,16 @@ const App = ({ pageContext, children, location }) => {
})
const toggleClick = (e) => setLabels({ ...labels, [e]: !labels[e] })
+ const title =
+ pageContext.node?.prefLabel ||
+ pageContext.node?.title ||
+ pageContext.node?.dctitle
return (