-
Notifications
You must be signed in to change notification settings - Fork 1
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
[feat]: Add support for custom fonts #430
base: master
Are you sure you want to change the base?
Conversation
* If added in public folder, mention the asset host and path in the url like this "https://fea.assettype.com/malibu/assets/ | ||
MalibuHeadlineSemiBold.woff2". | ||
* | ||
* The following origins are allowlisted and allowed for font serving via link tags as per official AMP documentation: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reframe the sentence The following origins are allowlisted and allowed ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That line is from the original docs.
<link rel="preload" as="style" crossorigin="anonymous" href={customFonts?.primary1} /> | ||
<link rel="preload" as="style" crossorigin="anonymous" href={customFonts?.secondary1} /> | ||
<link rel="preload" as="style" crossorigin="anonymous" href={customFonts?.primary2} /> | ||
<link rel="preload" as="style" crossorigin="anonymous" href={customFonts?.secondary2} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add condition to not add these links if there is no custom font
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
customFonts?: { | ||
primary1?: string | null; | ||
secondary1?: string | null; | ||
primary2?: string | null; | ||
secondary2?: string | null; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't make sense to add custom fonts inside render
render is for render props (custom UI elements) that the app sends
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is temp fix.
Actually plan is to add in ampConfig of BOLD. Platform team might take sometime to do the change so decided to do this change.
We can add outside render as in opts itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes.. let's add it outside render
under an object called customFonts
Description
At present, we support only google fonts by doing this we can support all the origin urls which AMP supports.
We will Pick up custom font url from amp config that is added in Bold. Settings > configure > amp under Fonts
Ref ticket: https://github.com/quintype/ace-planning/issues/837
Dependencies # (dependency-issue-reference)
Documentation # (link to the corresponding documentation changes)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Add custom font url in the custom font field in Bold and check whether its reflecting in the frontend or not
Checklist: