gradio icon indicating copy to clipboard operation
gradio copied to clipboard

Custom meta tags not fully respected in Telegram

Open rybakov-ks opened this issue 10 months ago • 3 comments

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? 🔎

  • [x] 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

rybakov-ks avatar May 21 '25 09:05 rybakov-ks

@rybakov-ks Hmm telegram uses normal og:image tags. Maybe it takes a bit longer to crawl this info.

From a quick search online, can you try the suggestion below and let me know if you still see an issue?

You can use Telegram's @webpagebot to update the link preview of your site. Just start the chat and send it the link to your website.

dawoodkhan82 avatar May 21 '25 14:05 dawoodkhan82

@dawoodkhan82 Thanks for the suggestion! Unfortunately, using @webpagebot didn't help - Telegram continues to display default meta tags .

Telegram screenshot - shows it's still pulling default og: tags: Image

Same issue in VK.com - this social network also ignores the overridden tags. Image

rybakov-ks avatar May 21 '25 16:05 rybakov-ks

I am also not getting the desired result. After looking at the code update.. were you adding the meta tags to the system?

It seems like NOT having meta tags in the system by default would be preferred. My custom meta tags are being ignored in favor of generic meta og tags.

Am I misunderstanding this?

Image

Oncorporation avatar May 24 '25 17:05 Oncorporation