Skip to content
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

Expose the HTML template, the render function and the App in libraries. [5pt] #557

Closed
SantosGuillamot opened this issue Sep 4, 2020 · 2 comments · Fixed by #687
Closed

Comments

@SantosGuillamot
Copy link
Member

SantosGuillamot commented Sep 4, 2020

This is part of the AMP feature. For full context please check out the final Implementation proposal.


HTML template

The Google AMP framework needs a specific HTML template because a normal HTML document doesn't validate.

For that reason, the @frontity/amp package needs to be able to overwrite the hardcoded HTML template.

This can be done with a beforeSSR function but needs the template to be exposed in libraries.frontity.

Render to Static Markup

The Google AMP framework doesn't need the custom data- attributes added by React, so instead of using renderToString, the @frontity/amp package needs to make Frontity use renderToStaticMarkup.

This can be done with a beforeSSR function. It'll be necessary to create a separate server.js file because we don't want to add react-dom/server to the client bundle.

// packages/amp/src/server.js
import { renderToStaticMarkup } from "react-dom/server";

export default {
  actions: {
    amp: {
      beforeSSR: ({ libraries }) => {
        libraries.frontity.render = renderToStaticMarkup;
      },
    },
  },
};

It needs the render function to be exposed in libraries.frontity.

@SantosGuillamot SantosGuillamot created this issue from a note in Sprint 7 (To do) Sep 4, 2020
@SantosGuillamot SantosGuillamot moved this from To do to Backlog in Sprint 7 Sep 4, 2020
@SantosGuillamot SantosGuillamot added this to To do in Sprint 8 via automation Oct 2, 2020
@SantosGuillamot SantosGuillamot added this to To do in Sprint 9 via automation Oct 29, 2020
@SantosGuillamot SantosGuillamot added this to To do in Sprint 10 via automation Nov 27, 2020
@SantosGuillamot SantosGuillamot moved this from To do to Backlog in Sprint 10 Nov 27, 2020
@SantosGuillamot SantosGuillamot added this to To do in Sprint 11 via automation Jan 26, 2021
@cristianbote cristianbote self-assigned this Jan 28, 2021
@luisherranz
Copy link
Member

@SantosGuillamot I've just noticed that the Sprint Card links get outdated. Maybe that's another good option to remove them in favor of the Feature Boards (the less work the better).

@SantosGuillamot
Copy link
Member Author

You are totally right. They change per project and we usually move them from 1 project to another, so it would be better handle in a GitHub board.

@cristianbote cristianbote linked a pull request Feb 4, 2021 that will close this issue
11 tasks
@cristianbote cristianbote moved this from In progress to In review in Sprint 11 Feb 4, 2021
@luisherranz luisherranz moved this from In review to In progress in Sprint 11 Feb 9, 2021
@SantosGuillamot SantosGuillamot added amp and removed feat-4 labels Feb 9, 2021
@SantosGuillamot SantosGuillamot added this to To do in AMP feature via automation Feb 9, 2021
@SantosGuillamot SantosGuillamot moved this from To do to In progress in AMP feature Feb 9, 2021
@cristianbote cristianbote moved this from In progress to In review in Sprint 11 Feb 12, 2021
Sprint 11 automation moved this from In review to Done Feb 12, 2021
AMP feature automation moved this from In progress to Done Feb 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
AMP feature
  
Done
Sprint 10
  
Backlog
Sprint 11
  
Done
Sprint 7
  
Backlog
Sprint 8
  
To do
Sprint 9
  
To do
Development

Successfully merging a pull request may close this issue.

3 participants