-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
External previews of Docusaurus links are inconsistent #3024
Comments
I also notice there is a difference. The best way is to compare the same site/page with 2 deployments:
Seems it could be related to this change: #2436 Anyway, @markerikson I don't think it's a bug, we don't currently specify what the preview should look like, nor guarantee that it should be consistent over time, particularly as we are still in alpha. Having a preference for a smaller version is likely subjective, and the whole D2 userbase would maybe not agree with you here. Note that we're also working on better social cards: #2968 If you have a specific html metadata requirements, and absolutely need an option to enforce these metadatas, we are open to discuss that. |
Yeah, that seems like it's likely responsible. Obviously DS itself isn't responsible for how Discord itself displays and formats previews, but it does seem like something about DS's generation is influencing that output. Ideally, I'd like to see something more similar to how it's looking with the React-Redux site (DSv1): a small image, so that the logo isn't a distraction. I think that's how it was showing up previously, and I'm actually not sure why there's no logo preview for the Redux core link there atm either. |
We could provide options to influence on the page metadata options, but it will be hard to satisfy perfectly all users in this regard, and handle all existing services saas services reading those metadatas We don't know exactly the metadatas you need, unless you know exactly what you want and can tell us ;) If some users want to enforce some metadatas, it's possible to swizzle the components. No need to copy everything. import OriginalDocItem from "@theme-original/DocItem";
import Head from "@docusaurus/Head";
export default function CustomDocItem(props) {
return (
<>
<Head>
<meta name="twitter:card" content="summary" />
</Head>
<OriginalDocItem {...props} />
</>
);
}
|
Saw an example of this again this evening: I decided to compare the header tags for Redux, which is on DS v2.alpha-54, and React-Redux, which is still on DS v1:
This must be due to the use of Frankly, I rather prefer having the smaller preview images - the giant ones distract from the title. Maybe that goes against SEO suggestions. So, what's the best approach for flipping that value for our docs? |
Currently this can be changed by swizzling the @theme/Layout comp and changing the header value, but if someone wants to contribute a new theme setting to that we can override the existing value, I'd be fine with that |
Since I've never tried doing the "swizzling" thing before, any pointers on how to do so? |
This gives you the ability to "override" any theme component (like gatsby shadowing) We add "--danger" because we can't guarantee the classic theme code will not be upgraded (or API surface updated), and you won't benefit from such upgrades, so if you can avoid swizzle it's better. The theme whitelist a list of components that are recommended to swizzle (no --danger needed). I'll add the meta option in a PR because sizzling is not very convenient for such an usecase. Somehow you can compare it to a more convenient patch-package alternative. |
Next release will allow to add/override any meta header: module.exports = {
// ...
themeConfig: {
metadatas: [{name: 'twitter:card', content: 'summary'}],
// ...
},
}; |
* ability to add/override theme html metadatas see #3024 * refactor/fix validateThemeConfig tests
Cool, thanks! |
🐛 Bug Report
I recently updated the Redux Toolkit docs to alpha.58 . The Redux core is still on alpha.54, while React-Redux is still on DSv1.
Somewhere between alpha.54 and alpha.58, something about the generated logos / preview images changed, such that when I paste links to the different docs into Discord, I get very differently-sized link previews:
Why are the logos sized so differently, and what recently changed to cause this?
Have you read the Contributing Guidelines on issues?
Yes
To Reproduce
Paste links to differing versions of the Redux docs into Discord or similar
Expected behavior
The Redux logo would be smaller, and consistently sized across DS alpha versions.
Actual Behavior
(Write what happened. Add screenshots, if applicable.)
Your Environment
Reproducible Demo
Paste these links as of today:
The text was updated successfully, but these errors were encountered: