-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update page title with dataset and include metadata title as description #845
Conversation
This changes page title from just "auspice" to "auspice / zika", "auspice / mumps / na", etc... I think this is generally helpful to find the right tab when multiple tabs are open. It's also recommended for SEO (https://support.google.com/webmasters/answer/7451184?hl=en). Currently, Google gives minimal information when searching for "nextstrain zika" or the like.
Google uses the <meta name="description"/> element to populate search results. Currently pages like Zika give text that reads "This work is made possible by the open sharing of genetic data..." rather than the more intended "Real-time tracking...". This update to description should hopefully resolve. See https://support.google.com/webmasters/answer/7451184?hl=en for more information.
+1 for this! One small change worth considering is maybe swapping the order of the title pieces, that is, putting "auspice" or "Nextstrain" last instead of first. For example, instead of "auspice / zika" or "auspice / mumps / na" using something similar to "zika / auspice" or "na / mumps / auspice". The idea here is that putting the detail first is useful when you have multiple Auspice/Nextstrain tabs open and want to know which is which. The first part of the title is least likely to be truncated by a small tab width. The site favicon shown on the tab of many browsers also already indicates the site (auspice/Nextstrain). |
Tested on nextstrain.org locally resulted in two changes: (a) moving the component higher up the tree as we want this to run for the Splash page, as well as for datasets. This allows nextstrain.org/groups/blab to show a title of `nextstrain / groups / blab`. (b) connected it to redux state, as we modify the URL in certain situations (e.g. /flu/avian -> /flu/avian/h5n1/ha) and we want the head to change accordingly here. Note that this URL changes without the `<Main>` (dataset display) component rerunning, and is currently only in nextstrain.org, not the default auspice server.)
Thanks @trvrb -- a nice improvement here. We use React Helmet for nextstrain.org as well. I've tested it on nextstrain.org locally and (i) moved the component higher up the tree and (ii) connected it to redux state. Why?
This is harder to do now that we import auspice as a normal dep in nextstrain.org, and hopefully we can improve this over time. You can do it following https://github.com/nextstrain/nextstrain.org#using-a-different-version-of-auspice: # nextstrain.org directory
npm link ${path_to_auspice_src}
npm link ${path_to_auspice_src}/node_modules/react
npm run build -- auspice # rebuild auspice
npm run server -- --verbose # start nextstrain.org server Note that this breaks my global install of auspice -- i.e. I can no longer run # auspice src directory
npm i --global .
Agreed that this would be better for multiple tabs (although multiple |
Thanks James. I agree with all the changes you've made. I also think that keeping |
While multiple calls to `<Helmet>` aren't problematic, it's conceptually simpler to manage this all from one place (the `<Head>` component in `head.js`). No changes in behavior.
Yup. This is a nice improvement 👍 |
Currently, our pages look like this to Google:
This updates the page title to be
auspice / ebola
orNextstrain / ebola
. I like this format (it's what I use for https://bedford.io). Here, I mainly want to make it easy to tell which tab is which when there are multiple auspice tabs or Nextstrain tabs open.The injection of the metadata title, ie "Real-time tracking" as should aid in Google giving less vague search results.
I first started with just setting
document.title
, but description was more difficult and Stackoverflow recommended React Helmet. This worked really smoothly.I believe that the extension set up with Nextstrain and https://github.com/nextstrain/nextstrain.org/blob/master/auspice/client/config.json#L13 should still work, but I wasn't able to test this (I couldn't figure out how to get a global auspice CLI from my local auspice src code).