Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

shroominic
Copy link

@shroominic shroominic commented May 12, 2024

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

Copy link

codecov bot commented May 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@jimkring
Copy link
Contributor

jimkring commented May 15, 2024

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

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants