-
Notifications
You must be signed in to change notification settings - Fork 230
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
[POC] [WIP] AMP validation fixes #878
Conversation
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.
The PR diff size of 23764 lines exceeds the maximum allowed for the inline comments feature.
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.
The PR diff size of 23764 lines exceeds the maximum allowed for the inline comments feature.
src/app/containers/Figure/index.jsx
Outdated
@@ -15,10 +16,14 @@ const renderCaption = captionValue => | |||
<Text text={captionValue} paragraphOverride={Caption} /> | |||
) : null; | |||
|
|||
const FigureContainer = ({ src, alt, ratio, copyright, caption }) => ( | |||
const FigureContainer = ({ src, alt, ratio, copyright, caption, platform }) => ( |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
import { PlatformContextProvider, PlatformContextConsumer } from './index'; | ||
|
||
describe('PlatformContext', () => { | ||
const testBrandNameWithServiceContext = platform => { |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
Fixes http://localhost:7080/news/articles/c9rpqy7pmypo.amp:55:14676 Custom JavaScript is not allowed. (see https://www.ampproject.org/docs/reference/spec#html-tags)
Code Climate has analyzed commit 1571299 and detected 5 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 100.0% (90% is the threshold). This pull request will bring the total coverage in the repository to 96.8% (0.0% change). View more on Code Climate. |
Resolves #873. This PR:
amp-boilerplate
CSS (encapsulated in one commit) - fixes Fix AMP validation: boilerplate AMP CSS #886.http://localhost:7080/news/articles/c9rpqy7pmypo.amp:51:2530 The tag 'head > style[amp-boilerplate] - old variant' appears more than once in the document. (see https://github.com/ampproject/amphtml/blob/master/spec/amp-boilerplate.md)
amp-img
only).The latter is the biggest change and introduces new conventions which ought to be discussed as a team.
AMP at the component level
We need to render different HTML depending on whether we're rendering the AMP page or the canonical page. This is in order for the AMP page to validate correctly.
For now, I've decided to create an
amp
directory inside any component which requires an AMP-specific override.Initially, I forwarded the
isAmp
boolean down the rendering pipeline to the Block container, so that the component is aware of which version is needed. However, on second thoughts, anisAmp
boolean is quite limited, in that we may also need to create custom modified components for other platforms in future (Facebook Instant Articles and Apple News, to name a couple). So I mapisAmp
to aplatform
string, where so far we have two possible options:amp
andcanonical
.#873 probably requires breaking down further, as full AMP validation & integration will involve changing lots of code. In addition to rendering different HTML at the component level, for some AMP components we will need to pull in additional AMP libraries in the
<head>
of the page. Plus, the Storybook integration requires some thought; currently AMP isn't pulled into the Storybook page so it is not possible to render the AMP versions of the component.AMP validation errors
So far, this PR gets our AMP errors down from:
...to:
The 'focusable' issue is encapsulated in #679 and is blocked on AMP-core, and the 'amp-custom' issue is encapsulated in #883 and is blocked on styled-components.
TODO: