@@ -94,13 +94,14 @@ <h3 class="text-lg font-medium mb-2" style="color: var(--text-color)">Start sear
9494 // Fetch concept details
9595 async function fetchConceptDetails ( iri , elementId ) {
9696 try {
97- const response = await fetch ( `{{ concept_api_url }}?iri=${ encodeURIComponent ( iri ) } ` ) ;
97+ const url = `{{ concept_api_base_url }}${ iri } ` ;
98+ const response = await fetch ( url ) ;
9899 const concept = await response . json ( ) ;
99100
100101 const infoDiv = document . getElementById ( elementId ) ;
101- if ( concept ) {
102+ if ( concept && response . status === 200 ) {
102103 const schemes = concept [ 'http://www.w3.org/2004/02/skos/core#inScheme' ] || [ ] ;
103- const definition = concept [ 'http://www.w3.org/2004/02/skos/core#definition' ] ?. find ( d => d [ '@language' ] === 'en ' ) ?. [ '@value' ] ;
104+ const definition = concept [ 'http://www.w3.org/2004/02/skos/core#definition' ] ?. find ( d => d [ '@language' ] === '{{ language }} ' ) ?. [ '@value' ] ;
104105
105106 infoDiv . innerHTML = `
106107 <div class="space-y-2">
@@ -109,7 +110,7 @@ <h3 class="text-lg font-medium mb-2" style="color: var(--text-color)">Start sear
109110 <i class="fas fa-layer-group mr-2" style="color: var(--text-tertiary)"></i>
110111 <div class="flex flex-wrap gap-1">
111112 ${ schemes . map ( scheme => `
112- <a href="/web/concept_scheme/${ scheme [ '@id' ] } " class="text-primary hover:text-primary-hover text-xs">
113+ <a href="/web/concept_scheme/${ scheme [ '@id' ] } ?language={{ language }} " class="text-primary hover:text-primary-hover text-xs">
113114 ${ scheme [ '@id' ] . split ( '/' ) . pop ( ) }
114115 </a>
115116 ` ) . join ( ', ' ) }
@@ -127,9 +128,12 @@ <h3 class="text-lg font-medium mb-2" style="color: var(--text-color)">Start sear
127128
128129 // Render MathJax for dynamically loaded content
129130 if ( typeof MathJax !== 'undefined' ) {
130- MathJax . typesetPromise ( [ infoDiv . querySelector ( '.mathjax-content' ) ] ) . catch ( function ( err ) {
131- console . log ( 'MathJax rendering error:' , err ) ;
132- } ) ;
131+ const mathContent = infoDiv . querySelector ( '.mathjax-content' ) ;
132+ if ( mathContent ) {
133+ MathJax . typesetPromise ( [ mathContent ] ) . catch ( function ( err ) {
134+ console . log ( 'MathJax rendering error:' , err ) ;
135+ } ) ;
136+ }
133137 }
134138 } else {
135139 infoDiv . innerHTML = '<span class="text-red-500 text-xs">Failed to load concept details</span>' ;
0 commit comments