Skip to content

Custom meta tags not fully respected in Telegram #11233

@rybakov-ks

Description

@rybakov-ks

Describe the bug

Bug Description
When using the head parameter in gr.Blocks() to customize meta tags (PR #10968), the custom tags work for X and Facebook, but Telegram still shows Gradio's default meta tags instead of the custom ones.

Expected Behavior
All meta tags specified in the head parameter should completely replace Gradio's default meta tags across all platforms (including Telegram).

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr

def build_gradio_interface() -> gr.Blocks:
  custom_head = """
  <!-- HTML Meta Tags -->
  <title>Sample App</title>
  <meta name="description" content="An open-source web application showcasing various features and capabilities.">
  
  <!-- Facebook Meta Tags -->
  <meta property="og:url" content="https://example.com">
  <meta property="og:type" content="website">
  <meta property="og:title" content="Sample App">
  <meta property="og:description" content="An open-source web application showcasing various features and capabilities.">
  <meta property="og:image" content="https://example.com/sample-image.jpg">
  
  <!-- Twitter Meta Tags -->
  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:creator" content="@example_user">
  <meta name="twitter:title" content="Sample App">
  <meta name="twitter:description" content="An open-source web application showcasing various features and capabilities.">
  <meta name="twitter:image" content="https://example.com/sample-image.jpg">
  <meta property="twitter:domain" content="example.com">
  <meta property="twitter:url" content="https://example.com">
  
  <!-- Meta Tags Generated via https://www.opengraph.xyz/ -->
  """
  
  with gr.Blocks(
    title="My App",
    head=custom_head,
  ) as demo:
    gr.HTML("<h1>My App</h1>")

  return demo

demo = build_gradio_interface()
demo.launch()

Screenshot

Image

Image

Logs

System Info

Gradio Environment Information:
------------------------------
Operating System: Linux
gradio version: 5.30.0
gradio_client version: 1.10.1

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
anyio: 4.9.0
audioop-lts is not installed.
fastapi: 0.115.12
ffmpy: 0.5.0
gradio-client: 1.10.1
groovy: 0.1.2
httpx: 0.28.1
huggingface-hub: 0.30.2
jinja2: 3.1.6
markupsafe: 2.1.5
numpy: 1.26.4
orjson: 3.10.16
packaging: 24.2
pandas: 2.2.3
pillow: 10.2.0
pydantic: 2.11.3
pydub: 0.25.1
python-multipart: 0.0.20
pyyaml: 6.0.2
ruff: 0.11.5
safehttpx: 0.1.6
semantic-version: 2.10.0
starlette: 0.46.2
tomlkit: 0.13.2
typer: 0.15.2
typing-extensions: 4.12.2
urllib3: 2.4.0
uvicorn: 0.34.1
mcp is not installed.
pydantic: 2.11.3
authlib is not installed.
itsdangerous is not installed.


gradio_client dependencies in your environment:

fsspec: 2024.10.0
httpx: 0.28.1
huggingface-hub: 0.30.2
packaging: 24.2
typing-extensions: 4.12.2
websockets: 15.0.1

Severity

I can work around it

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions