FastUI
FastUI copied to clipboard
Ability to add more meta tags e.g. for seo
example usage:
@app.get("/{path:path}", include_in_schema=False)
async def html_landing() -> HTMLResponse:
return HTMLResponse(
prebuilt_html(
title=settings.title,
api_root_url=settings.ui_root,
meta_extra={
"description": "A seo optimized description",
"keywords": "seo, optimized, keywords",
"author": "seo pro",
},
)
)
*edit: now passed as dict
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
:loudspeaker: Thoughts on this report? Let us know!
@shroominic would it make sense to pass in the meta_extra parameters to fastui as a dictionary or pydantic model, rather than raw html?
@shroominic would it make sense to pass in the meta_extra parameters to fastui as a dictionary or pydantic model, rather than raw html?
I totally agree, this (micro-syntax) doesn't look good.
@shroominic would it make sense to pass in the meta_extra parameters to fastui as a dictionary or pydantic model, rather than raw html?
good idea i fixed this now!
In principle, I'm ok with this change, but perhaps we should just add extra arguments to the prebuilt_html
function so that we can add type hints for the extra metadata? At least for common meta
things like description
. Then perhaps we could also have one final argument with extra data for the meta_str
...