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

Change the render to be renderToStaticMarkup. [3pt] #560

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

Change the render to be renderToStaticMarkup. [3pt] #560

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

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.


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 (Backlog) 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
@luisherranz luisherranz moved this from To do to Blocked in Sprint 11 Jan 29, 2021
@luisherranz
Copy link
Member

Blocked until #685 and #557 are finished.

@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
@SantosGuillamot SantosGuillamot moved this from Blocked to To do in Sprint 11 Feb 15, 2021
@cristianbote cristianbote self-assigned this Feb 16, 2021
@cristianbote cristianbote moved this from To do to In progress in Sprint 11 Feb 16, 2021
@cristianbote cristianbote linked a pull request Feb 17, 2021 that will close this issue
11 tasks
@cristianbote cristianbote moved this from In progress to In review in Sprint 11 Feb 19, 2021
@cristianbote cristianbote moved this from In review to Done in Sprint 11 Feb 22, 2021
@cristianbote cristianbote moved this from In progress to Done in AMP feature Feb 22, 2021
@SantosGuillamot
Copy link
Member Author

This issue wasn't closed automatically after merging the linked Pull Request because we merged it in a branch different than dev, so I'm closing this manually.

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