FastUI icon indicating copy to clipboard operation
FastUI copied to clipboard

Ability to add more meta tags e.g. for seo

Open shroominic opened this issue 9 months ago • 5 comments

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

shroominic avatar May 12 '24 15:05 shroominic

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

:loudspeaker: Thoughts on this report? Let us know!

codecov[bot] avatar May 12 '24 15:05 codecov[bot]

@shroominic would it make sense to pass in the meta_extra parameters to fastui as a dictionary or pydantic model, rather than raw html?

jimkring avatar May 15 '24 23:05 jimkring

@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.

hasansezertasan avatar May 16 '24 15:05 hasansezertasan

@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!

shroominic avatar May 16 '24 16:05 shroominic

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...

sydney-runkle avatar May 30 '24 13:05 sydney-runkle