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

[doc]: Instructions on how to display backend homepage (from CMS) as a homepage for Venia #3033

Closed
1 of 2 tasks
phtmgt opened this issue Mar 3, 2021 · 11 comments
Closed
1 of 2 tasks
Labels
documentation This pertains to documentation. Progress: done

Comments

@phtmgt
Copy link

phtmgt commented Mar 3, 2021

Describe the request
Currently, there are no instructions on how to set the homepage to either a concrete CMS page from the backend or the designated (backend) homepage. This is very important for anyone not using EE and Page Builder.

Possible solutions
In order to use a CMS page as a home page you need to:

  1. XXX
  2. YYY
  3. ...

Please let us know whether this is a new topic or a topic change request:

  • New Topic Request (ie. missing entire topic/section)
  • Topic Change Request (ie. spelling, organization)
@phtmgt phtmgt added the documentation This pertains to documentation. label Mar 3, 2021
@m2-assistant
Copy link

m2-assistant bot commented Mar 3, 2021

Hi @plamenh. Thank you for your report.
To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


@sirugh
Copy link
Contributor

sirugh commented Mar 3, 2021

@magento export issue to JIRA project PWA as Story

@github-jira-sync-bot
Copy link

✅ Jira issue (https://jira.corp.magento.com/browse/PWA-1490) is successfully created for this issue.

@sirugh
Copy link
Contributor

sirugh commented Mar 3, 2021

@plamenh thank you for this request - I have created linked it to our internal backlog and we will get to it when we can :)

@phtmgt
Copy link
Author

phtmgt commented Mar 4, 2021

I found the source of the confusion (at least for me):

useCmsPage Line 62:

// TODO: we shouldn't be validating strings to determine if the page has content or not
    const hasContent = useMemo(() => {
        return (
            cmsPage &&
            cmsPage.content &&
            cmsPage.content.length > 0 &&
            !cmsPage.content.includes('CMS homepage content goes here.')
        );
    }, [cmsPage]);

I think this line should go. If it does not, we need this in the docs.

@sirugh
Copy link
Contributor

sirugh commented Mar 4, 2021

Are you talking about the static text CMS homepage content goes here.? I believe that comes from the back end, which means that if you had customized your cms (and replaced that string) it would no longer be present, so your custom homepage would render.

@phtmgt
Copy link
Author

phtmgt commented Mar 4, 2021

Yeah, I understood that, but I don't get the reasoning behind it. Why not just display the homepage content there regardless of whether it's been changed from default or not? I spent a few hours trying to figure out how to display my homepage when all I had to do is change a text that is stored in the db. Does not make any sense. I mean, why would frontend logic depend on a string of text stored in the database?

@phtmgt phtmgt closed this as completed Mar 17, 2021
@sirugh
Copy link
Contributor

sirugh commented Mar 17, 2021

I mean, why would frontend logic depend on a string of text stored in the database?

@plamenh Apologies! I forgot to respond. ~17 months ago we made a change to this file in this PR: #1872. There was a comment which seems to have been lost: Only render <RichContent /> if the page isn't empty and doesn't contain the default CMS Page text.

So it appears that the original intent was literally to prevent the default CMS page text from rendering, but I don't know why we wanted to prevent it. I'm sorry it was confusing - I will see if we can remove that line.

@sirugh
Copy link
Contributor

sirugh commented Mar 17, 2021

Ok I spoke to @davemacaulay who reminded me that the reason for this code is so we can render our venia-ui CategoryList component in the event users have not configured the default cms content. Basically, it is a fall back component rendered specifically in that case.

@phtmgt
Copy link
Author

phtmgt commented Mar 17, 2021

It's all good, just that comment is now missing, it would be great if it's back there. Someone might just skim through line 36 w/out investing much thought (as I did).

@sirugh
Copy link
Contributor

sirugh commented Mar 17, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This pertains to documentation. Progress: done
Projects
None yet
Development

No branches or pull requests

4 participants