EXPLORE / {label(page.get("type","PAGE")).upper()}
{label(page.get("title", ""))}
{label(page.get("summary", ""))}'
html=html.replace('',intro+'',1)
html=html.replace('',''+header,1)
html=html.replace('',foot+'',1)
html=html.replace('','',1)
return html
def write_assets(dist,records):
from shutil import copy2
copy2(ASSETS/'factory.css',dist/'assets'/'factory.css')
copy2(ASSETS/'site-runtime.js',dist/'assets'/'site-runtime.js')
search=[{'title':r['title'],'url':r['route'],'summary':(r.get('summary') or '')[:360],
'type':r['type'], 'brand':str((json.loads(r.get('meta_json') or '{}').get('fields') or {}).get('brand',''))}
for r in records if r.get('route') and r['route']!='/']
(dist/'search-index.json').write_text(json.dumps(search,ensure_ascii=False),encoding='utf-8')
def search_page(site):
from html import escape
return f'''站内搜索 - {escape(site['name'])}
← 返回首页搜索网站内容
'''
EXPLORE / {label(page.get("type","PAGE")).upper()}