Skip to content
This repository was archived by the owner on Jun 7, 2026. It is now read-only.

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

Open
shroominic wants to merge 2 commits into
pydantic:mainfrom
shroominic:meta-extra
Open

Ability to add more meta tags e.g. for seo#312
shroominic wants to merge 2 commits into
pydantic:mainfrom
shroominic:meta-extra

Conversation

@shroominic

@shroominic shroominic commented May 12, 2024

Copy link
Copy Markdown

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

codecov Bot commented May 12, 2024

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jimkring

jimkring commented May 15, 2024

Copy link
Copy Markdown
Contributor

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

@hasansezertasan

Copy link
Copy Markdown
Contributor

@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

Copy link
Copy Markdown
Author

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

@sydney-runkle

Copy link
Copy Markdown
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants