Add business type, location and logo to the structured data

Three optional settings extend LocalBusiness: a subtype from a fixed list, coordinates as a pair, and a logo from the media library. Without them the output stays as it was, and stored settings need no migration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kantarciandClaude Opus 5.5 committed 2026-11-09 08:02:38 +01:00
1 parent d75c295f59
commit f2c04b311f
7 files changed
+188 -2

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
import { openMedia } from './media.js';
/*
* The logo for the structured data: one image from the media library, shown as a small preview.
* It is saved with the form, like every other value on this screen.
*/
const field = document.querySelector('[data-logo-field]');
if (field) {
const input = field.querySelector('[name="organisationLogoMediaId"]');
const current = field.querySelector('.favicon-current');
const choose = field.querySelector('[data-logo-choose]');
const remove = field.querySelector('[data-logo-remove]');
const show = (label, src = '') => {
current.replaceChildren();
if (src) {
const image = new Image(64, 64);
image.className = 'favicon-preview logo-preview';
image.alt = '';
image.src = src;
current.append(image);
}
const text = document.createElement('span');
text.textContent = label;
current.append(text);
choose.textContent = input.value ? 'Anderes Bild wählen' : 'Bild wählen oder hochladen';
remove.hidden = !input.value;
};
choose.addEventListener('click', () => openMedia({ needsAlt: false, onChoose: items => {
if (!items.length) return;
input.value = items[0].id;
show(`„${items[0].title}“ – wird beim Speichern übernommen.`, items[0].variants[0].src);
choose.focus();
} }));
remove.addEventListener('click', () => {
input.value = '';
show('Kein Logo gewählt – wird beim Speichern übernommen.');
choose.focus();
});
}