mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 13:05:32 +09:00
fix(app): let custom branding override the built-in meta description (#1910)
This commit is contained in:
1 parent
4ee1b2294a
commit
904987795a
1 file changed
+5
-6
@@ -201,15 +201,14 @@ function removeDocumentLink(rel: string): void {
|
||||
|
||||
function upsertDocumentMeta(name: string, content: string): void {
|
||||
if (typeof document === 'undefined') return;
|
||||
const selector = `meta[name="${name}"][data-fluxer-branding="true"]`;
|
||||
const existing = document.head.querySelector<HTMLMetaElement>(selector);
|
||||
const meta = existing ?? document.createElement('meta');
|
||||
const brandedMeta = document.head.querySelector<HTMLMetaElement>(`meta[name="${name}"][data-fluxer-branding="true"]`);
|
||||
const meta = brandedMeta ?? document.createElement('meta');
|
||||
meta.name = name;
|
||||
meta.content = content;
|
||||
meta.dataset.fluxerBranding = 'true';
|
||||
if (!existing) {
|
||||
document.head.appendChild(meta);
|
||||
}
|
||||
if (brandedMeta) return;
|
||||
const precedingMeta = document.head.querySelector<HTMLMetaElement>(`meta[name="${name}"]`);
|
||||
document.head.insertBefore(meta, precedingMeta);
|
||||
}
|
||||
|
||||
function removeDocumentMeta(name: string): void {
|
||||
|
||||
Reference in new issue
Block a user