A dcc.DocumentTitle Component for Updating the Page Title Dynamically
See original GitHub issueThis would enable users to update the tab:
- When navigating pages with
dcc.Location - When updating tabs with
dcc.Tabs
I’ve helped a customer with a similar component with an implementation below:
import {Component} from 'react';
import PropTypes from 'prop-types';
export default class DocumentTitle extends Component {
componentDidMount() {
document.title = this.props.children;
}
componentWillReceiveProps(nextProps) {
document.title = nextProps.children;
}
render() {
return null;
}
}
DocumentTitle.defaultProps = {
children: 'Dash'
}
DocumentTitle.propTypes = {
children: PropTypes.string,
id: PropTypes.string
}
To bring this into the library, we would need to:
- incorporate that code as a new component
- then add some tests
- Modify
componentWillReceivePropsto the non-deprecated way of doing things with React - Add docs to:
dash.plotly.com/urlsdash.plotly.com/dash-core-comoponents/documenttitle. Provide a cross link to/external-resourcesto mention how to set the page title via the server side template, which would provide the page title on page load rather than dynamically. Doing this on page load would be better for SEO.- Provide a link to these docs from the
external-resourcespage where we discuss how to set thetitlein the server-side template and mention the limitations of that method (it will only update the page title on page load, not on subsequent navigation viadcc.Link)
If any community member takes this on before we get around to, please comment below!
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Change the title in tab - Dash Python - Plotly Community Forum
I have a multipage app where each page currently has Dash as the title. How can I change it to say something else?...
Read more >Dynamically update the title in Dash Plotly - Stack Overflow
I want to plot 'Number' column values from the example's data frame with the dynamically updated title. I'll try to work on your...
Read more >@plotly/webpack-dash-dynamic-import - Package Manager
Fast, reliable, and secure dependency management.
Read more >NICHD Data and Specimen Hub (DASH) Tutorial - NIH
Clicking on a study title will take you to the "Study Overview" page. ... Study Components (Datasets and Documents), Collections, Biospecimens.
Read more >Docstrings · Dash.jl - JuliaHub
Configures the document.title (the text that appears in a browser tab) text ... page through 10,000 rows in data 100 rows at a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

OK, this feature is now available in
dash==1.14.0. and is documented in http://dash.plotly.com/external-resources. See the “Update the Document Title Dynamically based off of the URL or Tab” example.I’ll keep this issue open to consider a
dcc.DocumentTitlecomponent which would enable a Python interface to updating the title. The current example documented above uses a clientside callback (JavaScript).Hi there, I tried to set the “app.title” and the “app._favicon” for a monitoring app, searched and found this discussion. But I slightly disagree with your suggestion. From the view of the user (me), my fist attempt was to simply create the “app.id” attribute for the use as the output target with usual callback mechanism. This of course doesnt worked, but instead of creating more specialiced dcc function, this would be a way more compatible solution. First drawback: I dont know the dash code, so this maybe wont be easy to implement Second drawback: A consequence would be a change “app.layout” to the formal better “app.children” to make the app a proper parent. kr, Tx.