diff --git a/docs/framework/seo.mdx b/docs/framework/seo.mdx index 700b7508c..01af89993 100644 --- a/docs/framework/seo.mdx +++ b/docs/framework/seo.mdx @@ -10,7 +10,7 @@ Writer Framework offers you the possibility of optimizing metadata to optimize y The page title is editable for web crawlers. This title is a key element for the SEO of your application. A bot will not load the app. It will see `Writer Framework` by default. ```python -writer.serve.configure_page_head(title="My amazing app") +writer.serve.configure_webpage_metadata(title="My amazing app") ``` If you need dynamic title,you can use a function instead of a hard coded parameter. The title will be evaluated when the Robot loads the page. @@ -20,7 +20,7 @@ def _title(): last_news = db.get_last_news() return f"Last news: {last_news.title}" -writer.serve.configure_page_head(title=_title) +writer.serve.configure_webpage_metadata(title=_title) ``` ### Configure meta tags @@ -29,7 +29,7 @@ http headers allow you to specify a title, a description and keywords which will *./server_setup.py* ```python -writer.serve.configure_page_head( +writer.serve.configure_webpage_metadata( title="My amazing app", meta={ "description": "my amazing app", @@ -50,7 +50,7 @@ def _meta(): "author": "Amazing company" } -writer.serve.configure_page_head(meta=_meta) +writer.serve.configure_webpage_metadata(meta=_meta) ``` ### Configure social networks @@ -58,7 +58,7 @@ writer.serve.configure_page_head(meta=_meta) When you share a link on social networks, they will try to fetch the metadata of the page to display a preview. ```python -writer.serve.configure_page_head( +writer.serve.configure_webpage_metadata( opengraph_tags= { "og:title": "My App", "og:description": "My amazing app", @@ -79,6 +79,6 @@ def _opengraph_tags(): "og:url": f"https://myapp.com/news/{last_news.id}" } -writer.serve.configure_page_head(opengraph_tags=_opengraph_tags) +writer.serve.configure_webpage_metadata(opengraph_tags=_opengraph_tags) ``` diff --git a/src/writer/serve.py b/src/writer/serve.py index 951288693..67ddf9580 100644 --- a/src/writer/serve.py +++ b/src/writer/serve.py @@ -560,7 +560,7 @@ async def lifespan(app: FastAPI): async with _lifespan_invoke(writer_lifespans, app): yield -def configure_page_head( +def configure_webpage_metadata( title: Union[str, Callable[[], str]] = "Writer Framework", meta: Optional[Union[Dict[str, Any], Callable[[], Dict[str, Any]]]] = None, opengraph_tags: Optional[Union[Dict[str, Any], Callable[[], Dict[str, Any]]]] = None @@ -568,7 +568,7 @@ def configure_page_head( """ Configures the page header for SEO and social networks from `server_setup` module. - >>> writer.serve.configure_page_head( + >>> writer.serve.configure_webpage_metadata( >>> title="my App", >>> meta={ >>> "description": "my amazing app", @@ -591,14 +591,14 @@ def configure_page_head( >>> "author": "Amazing company" >>> } - >>> writer.serve.configure_page_head( + >>> writer.serve.configure_webpage_metadata( >>> title=generated_title >>> meta=generated_meta_tags >>> ) OpenGraph tags are used by social networks to display information about the page. WF support them. - >>> writer.serve.configure_page_head( + >>> writer.serve.configure_webpage_metadata( >>> title=generated_title >>> opengraph_tags= { >>> "og:title": "My App", @@ -614,7 +614,7 @@ def configure_page_head( >>> "og:description": "My amazing app", >>> } - >>> writer.serve.configure_page_head( + >>> writer.serve.configure_webpage_metadata( >>> title=generated_title >>> opengraph_tags= generated_opengraph_tags >>> )