Bugfix
This commit is contained in:
@@ -158,7 +158,7 @@ Contao 5 – Frontend Module Template
|
|||||||
for (const hit of hits) {
|
for (const hit of hits) {
|
||||||
|
|
||||||
const node = template.content.cloneNode(true);
|
const node = template.content.cloneNode(true);
|
||||||
const item = node.firstElementChild;
|
const item = node.firstElementChild; // <div class="search-item">
|
||||||
|
|
||||||
// TYPE → CSS-Klasse
|
// TYPE → CSS-Klasse
|
||||||
if (hit.type) {
|
if (hit.type) {
|
||||||
@@ -170,28 +170,30 @@ Contao 5 – Frontend Module Template
|
|||||||
}
|
}
|
||||||
|
|
||||||
const image = item.querySelector('.siteimage');
|
const image = item.querySelector('.siteimage');
|
||||||
const img = image.querySelector('img');
|
const img = image.querySelector('img'); // ✅ EINMAL
|
||||||
const title = item.querySelector('.title');
|
const title = item.querySelector('.title');
|
||||||
const extract = item.querySelector('.extract');
|
const extract = item.querySelector('.extract');
|
||||||
const path = item.querySelector('.pfad');
|
const path = item.querySelector('.pfad');
|
||||||
const link = item.querySelector('.masterurl');
|
const link = item.querySelector('.masterurl');
|
||||||
|
|
||||||
|
// Title & Link
|
||||||
title.textContent = hit.title || '';
|
title.textContent = hit.title || '';
|
||||||
link.href = hit.url || '#';
|
link.href = hit.url || '#';
|
||||||
link.title = hit.title || '';
|
link.title = hit.title || '';
|
||||||
|
|
||||||
|
// Extract
|
||||||
if (hit._formatted?.text) {
|
if (hit._formatted?.text) {
|
||||||
extract.innerHTML = hit._formatted.text;
|
extract.innerHTML = hit._formatted.text;
|
||||||
} else {
|
} else {
|
||||||
extract.textContent = '';
|
extract.textContent = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Path
|
||||||
if (hit.url) {
|
if (hit.url) {
|
||||||
path.textContent = hit.url.replace(/^https?:\/\//, '');
|
path.textContent = hit.url.replace(/^https?:\/\//, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
const img = image.querySelector('img');
|
// Image
|
||||||
|
|
||||||
if (hit.poster) {
|
if (hit.poster) {
|
||||||
img.src = hit.poster;
|
img.src = hit.poster;
|
||||||
img.alt = hit.title || '';
|
img.alt = hit.title || '';
|
||||||
|
|||||||
Reference in New Issue
Block a user