Skip to content

Extend social meta tags - #4024

Merged
T4rk1n merged 5 commits into
plotly:devfrom
AnnMarieW:extend-social-meta-tags
Oct 2, 2026
Merged

T4rk1n merged 5 commits into
plotly:devfrom
AnnMarieW:extend-social-meta-tags

Conversation

@AnnMarieW

Copy link
Copy Markdown
Collaborator

closes #2699

Currently, social media meta tags are automatically added for apps using Dash Pages.

This PR extends the existing include_pages_meta to regular Dash apps. The meta tags will be added if there is an app.descrption or app.image.

The app.image can be an asset filename or a URL.

For Pages apps, the app-level values provide defaults that can be overridden by page-level metadata.

Question:

  • Should there be a default image? If so, what's the best way to add one - using a URL?
  • If a default image is added, then the metatags would be generated for all apps. Should it be opt-in?

To do:

  • add tests
  • add changelog
  • write docs and forum post

sample app

from dash import Dash, html

app = Dash(title="my title", description="my description", image="my_app.png")

app.layout = html.Div(["Hey!  Meta tags!"])

if __name__ == "__main__":
    app.run(debug=True)
image

@camdecoster

Copy link
Copy Markdown
Contributor

Thanks Ann Marie! Philippe will take a look soon.

@T4rk1n T4rk1n left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should there be a default image? If so, what's the best way to add one - using a URL?

I don't think we should add a default image, the image should be specific to the app to make it stand out.

We also have thumbnails and card on plotly cloud that are auto generated from the content, I think those are better than a generic default.

Code looks good, just need to add some tests.

@sonarqubecloud

sonarqubecloud Bot commented Oct 1, 2026

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@sonarqubecloud

sonarqubecloud Bot commented Oct 1, 2026

Copy link
Copy Markdown

@T4rk1n T4rk1n left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💃

@T4rk1n
T4rk1n merged commit babecd5 into plotly:dev Oct 2, 2026
38 of 39 checks passed
@AnnMarieW

AnnMarieW commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

@T4rk1n

I forgot to add a changelog. Would you like a separate PR?

Also, this PR makes the image for pages accept either a path to a file or a url. This makes the image_url unnecessary. Should it be deprecated? Or just the docstrings for image and image_url updated?

  • image_url:
    Overrides the image property and sets the <image> meta tag to the provided image URL.

https://github.com/plotly/dash/blob/dev/dash/_pages.py#L241

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.

enable adding default meta tags

3 participants