Artikel 15-17, 22-24, 27-28; H1 in der Score-Bewertung

This commit is contained in:
2026-09-22 14:38:02 +02:00
parent 28912cf493
commit afc132f7b8
4 changed files with 106 additions and 85 deletions

20
build/briefe_holen.py Normal file
View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
"""Holt briefe/brief-SLUG.json aus Gitea nach build/lokal/briefe/SLUG.json. Aufruf: python3 build/briefe_holen.py SLUG [...]"""
import base64, json, os, sys
exec(open(os.path.join(os.path.dirname(__file__), 'push_gitea.py'), encoding='utf-8').read().split('def sammle')[0])
os.makedirs('build/lokal/briefe', exist_ok=True)
for s in sys.argv[1:]:
code, d = ruf('GET', f"{REPO}/contents/briefe/brief-{s}.json?ref=main")
if code != 200:
print('fehlt', s); continue
b = json.loads(base64.b64decode(d['content']).decode())
json.dump(b, open(f'build/lokal/briefe/{s}.json', 'w', encoding='utf-8'), ensure_ascii=False, indent=2)
z = b.get('zusatz', {})
print(f"== {s} | {b['query_id']} | Ziel {b['wortzahl_ziel']}")
print(' Pflicht:', ' | '.join(f"{x['begriff']}:{x['min']}-{x['max']}" for x in b['begriffe_pflicht']))
print(' Titel:', ', '.join(z.get('begriffe_titel', [])))
print(' Desc:', ', '.join(z.get('begriffe_description', [])))
print(' H2:', ', '.join(z.get('begriffe_h2', [])[:25]))
erw = sorted(b['begriffe_erweitert'], key=lambda x: -(x['bei_wettbewerbern_pc'] or 0))
print(' Erweitert:', ', '.join(x['begriff'] for x in erw[:45]))
print(' Fragen:', ' / '.join(f['frage'] for f in b['fragen'][:8]))

View File

@@ -179,12 +179,13 @@ while ((m = re.exec(String(artikel.content_html || ''))) !== null) {
}
const shortcodes = (String(artikel.content_html || '').match(/\[skrift_preis[^\]]*\]/g) || []);
// NeuronWriter bewertet nur den uebergebenen Text. Kurzantwort und FAQ stehen
// NeuronWriter bewertet nur den uebergebenen Text. Titel (H1), Kurzantwort und FAQ stehen
// aber auf der fertigen Seite, also gehoeren sie in die Bewertung. Der gespeicherte
// Artikel bleibt unveraendert, das hier ist nur der Pruefkoerper.
const faqText = (Array.isArray(artikel.faq) ? artikel.faq : [])
.map(f => `<h3>${f.frage || ''}</h3><p>${f.antwort || ''}</p>`).join('\n');
const bewertungs_html = [
artikel.titel ? `<h1>${artikel.titel}</h1>` : '',
artikel.kurzantwort ? `<p>${artikel.kurzantwort}</p>` : '',
artikel.content_html || '',
faqText ? `<h2>${artikel.faq_ueberschrift || 'Häufige Fragen'}</h2>\n${faqText}` : '',

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
"""Lokaler NeuronWriter-Score, identischer Pruefkoerper wie WF2 (Kurzantwort + Inhalt + FAQ).
"""Lokaler NeuronWriter-Score, identischer Pruefkoerper wie WF2 (H1 + Kurzantwort + Inhalt + FAQ).
Aufruf: python3 build/nw_score.py artikel/artikel-SLUG.json [...]"""
import json, os, sys, urllib.request
@@ -15,7 +15,7 @@ E = env()
for pfad in sys.argv[1:]:
a = json.load(open(pfad, encoding='utf-8'))
faq = '\n'.join(f"<h3>{f.get('frage','')}</h3><p>{f.get('antwort','')}</p>" for f in a.get('faq') or [])
html = '\n'.join([f"<p>{a['kurzantwort']}</p>" if a.get('kurzantwort') else '', a['content_html'],
html = '\n'.join([f"<h1>{a['titel']}</h1>", f"<p>{a['kurzantwort']}</p>" if a.get('kurzantwort') else '', a['content_html'],
f"<h2>{a.get('faq_ueberschrift') or 'Häufige Fragen'}</h2>\n{faq}" if faq else ''])
body = json.dumps({'query': a['query_id'], 'html': html, 'title': a.get('seo_titel') or a['titel'],
'description': a.get('seo_beschreibung', '')}).encode()

File diff suppressed because one or more lines are too long