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

feat: add metadata for SEO and social media sharing - WF-77 #608

Conversation

FabienArcellier
Copy link
Collaborator

@FabienArcellier FabienArcellier commented Oct 29, 2024

This PR implement a way to manage SEO and social media metadata.

server_setup.py

import writer.serve

writer.serve.configure_page_head(
    title="Fabien Arcellier App",
    meta={
        "description": "My amazing app",
        "author": "Fabien Arcellier",
        "keywords": "fastapi, python, websockets, asyncio, webserver"
    },
    opengraph_tags={
        "og:title": "Fabien Arcellier App",
        "og:description": "My amazing app",
        "og:url": "https://fabienarcellier.com",
        "og:type": "website",
        "og:locale": "en_US",
        "og:image": "https://fabienarcellier.com/logo.png",
    }
)

Now - Before
image

  • document the feature
  • share impact of the feature in PR

@FabienArcellier FabienArcellier added the enhancement New feature or request label Oct 29, 2024
@FabienArcellier FabienArcellier self-assigned this Oct 29, 2024
@@ -556,6 +559,78 @@ async def lifespan(app: FastAPI):
async with _lifespan_invoke(writer_lifespans, app):
yield

def configure_page_head(
Copy link
Collaborator Author

@FabienArcellier FabienArcellier Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename the function to something more explicit

  • configure_app_seo
  • configure_app_heads
  • ...

Do you have proposal ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say configure_html_head

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • configure_webpage_metadata

@FabienArcellier FabienArcellier marked this pull request as ready for review November 6, 2024 16:35
docs/framework/seo.mdx Outdated Show resolved Hide resolved
src/writer/serve.py Outdated Show resolved Hide resolved
docs/framework/seo.mdx Show resolved Hide resolved
@FabienArcellier FabienArcellier force-pushed the feat/547-add-metadata-for-social-media-sharing branch from b9ba3e8 to f126497 Compare November 8, 2024 06:13
@FabienArcellier FabienArcellier changed the title feat/add metadata for SEO and social media sharing - WF-77 feat: add metadata for SEO and social media sharing - WF-77 Nov 8, 2024
* feat: implement configure_page_head signature
* feat: implement the settings
* feat: implement injection of meta and opengraph
* docs:write documentation about this feature
* fix: french in documentation
* fix: escape variable before rendering html
* fix: change the name of the function into `configure_webpage_metadata`
@FabienArcellier FabienArcellier force-pushed the feat/547-add-metadata-for-social-media-sharing branch from fd3ad1c to 517d59b Compare November 21, 2024 08:09
@ramedina86 ramedina86 merged commit 4dd52d8 into writer:dev Nov 29, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants