Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
UX approved removing the Youtube/learn button from the normal catalog and updated the styling.
There are two sets of changes worth mentioning in this PR.
.ymldoesn't support variables per se, but you can use an anchor alias pattern like this:Then reference that anchor like this:
fields: *someFieldsThis makes our config more DRY and more reliable to edit if you ever want to make a change to a data structure that is shared by more than one part of the config.
If we like this pattern I have another branch ready that refactors the config to use anchors/aliases in a number of other places, we can take hundreds of lines out of the config. We could go further and use a library like js-yaml to build the config but that would be a bigger lift.
feature/update-about...feature/anchor-alias
Takes about 300 lines out of the config.
gatsby-transformer-remark-frontmatterat some point I reworked the way we put data into markdown when text needs to be styled, or have links in it. Currently we use html to put links in markdown in some places, and in other places we have separate query fields for text to style/emphasize or for links.RichTextrefers to queried fields that have a main text field, an optional emphasis field, and an option link field with text and url subfields.The util
renderRichTextFieldswill match the emphasis text in the main text body and italicize it, returning a span, and will return an anchor tag matching the text from a link field to the text in the main body.This seems more straightforward than the way I was doing it before. The data for a given block of text is not spread out between multiple query fields, and the formatting utils are a bit more complicatd, but generalized and not in the component like they were before.
Getting the necessary data before required querying
And then composing the primary and disease sections with the appropriate emphasis and links, which was not a relationship captured by the data.
Now we query:
The whole block is typed as
RichText(good name? idk) and passed intorenderRichTextFields, with a styling arg in the case of emphasis