Skip to content

react-snap + SEO + SMO + Per page meta tags#45

Closed
hsab wants to merge 9 commits into
masterfrom
react-snap
Closed

react-snap + SEO + SMO + Per page meta tags#45
hsab wants to merge 9 commits into
masterfrom
react-snap

Conversation

@hsab
Copy link
Copy Markdown
Collaborator

@hsab hsab commented May 20, 2020

This is not intended for merging but for demonstration and some review if we should go ahead. I think the benefits outweigh the downsides, although I can't seem to think of any for now.
For the time being I'm opening it so can build locally to test and discuss here.

It's intended to address #43. And it actually turned out to be much easier than I thought.

Adds dependencies react-snap and react-helmet. I got a recipe for managing SEO from here as suggested in the react-snap's recipes doc.

For proper SEO and SMO management, the website needs to be pre-rendered. This is what react-snap does; helmet for head management.

So far seems to be working, except some minor issues with setParentHeight.Width where it wouldn't run when the component had mounted.

// Had to remove parentW/H because the static build was behaving strangely when setting the proper values
<div
className={style.wrapper}
ref={wrapperEl}
>

I managed to solve it by removing the hs/react dependency and resorting to pure css although had to resort to vh :(

.title {
color: #e3f994;
font-size: 17vw;
font-family: sans-serif;
font-weight: 700;
line-height: normal;
/* Had to modify because the static build was behaving strangely when setting the proper values */
margin-top: 50vh;
transform: translateY(-50%);
}

Let me know what you think.

EDIT: Just found some more issues. For some reason it's acting up if directly accessing the work through the address bar. className={style.wrapper} is confused with className={style.container}

hsab added 2 commits May 19, 2020 23:38
requires react-helmet & seo component.
seo component taken from:
--- https://github.com/stereobooster/an-almost-static-stack/blob/react-snap/src/components/Seo.js
this allows for building semi-static, pre-rendered html files that are then hydrated on load.
tested with animation and it works.
@hsab hsab requested a review from blerchin May 20, 2020 07:23
@hsab hsab mentioned this pull request May 20, 2020
@hsab hsab marked this pull request as draft May 20, 2020 16:20
@hsab hsab marked this pull request as ready for review May 20, 2020 17:37
@blerchin
Copy link
Copy Markdown
Owner

Interesting. Yeah the seo problem is a doozy.
I haven't used react-snap or the prerendering approach before, but this is promising. Seems a lot less frustrating than trying to do server-side rendering (have wasted months of my life trying to get that working).

Another approach would be to generate html files for each artist/page. Basically, just copies of the current public/index.html with correct metadata for each artist. This addresses meta/open graph/facebook tags but would not render "flat" html files. My understanding is google and most search engines crawl with a js-enabled browser these days so they actually can get to pages inside a SPA.

@hsab
Copy link
Copy Markdown
Collaborator Author

hsab commented May 20, 2020

Yeah I remember when google and the likes announced that they're gonna parse with js enabled. What I'm more concerned with is SMO and proper social media sharing with appropriate og meta tags. I think the works will be shared online a lot, and good og tags could even further the dissemination.

There was a problem with puppeteer using my local chromium path. Netlify deployment is fixed now if you want to check it out.

Even if we decide to scarp react-snap. Helm and Seo recipe are really nice!

@hsab
Copy link
Copy Markdown
Collaborator Author

hsab commented May 20, 2020

Also here's the issue I was talking about.
https://deploy-preview-45--kind-tesla-a088c1.netlify.app/graham-akins/

If you open the link directly with using routes, the {style.wrapper} class changes to container for some reason. I wonder if can just rename the style file to reduce confusion.

@blerchin
Copy link
Copy Markdown
Owner

Wow, that is strange. I need to work on other stuff right now but can take a look later today.

@hsab
Copy link
Copy Markdown
Collaborator Author

hsab commented May 20, 2020

Also FYI:
Screen Shot 2020-05-20 at 10 48 05 AM

That's coming from

In erin-cooney/index.html:

link http://repetitionrepetition.com
source http://repetitionrepetition.com/launch2.mp4
In zeynep-abes/index.html:

link http://repetitionrepetition.com
source http://repetitionrepetition.com/launch2.mp4

Since it builds statically it becomes an issue.

@brysonian
Copy link
Copy Markdown
Collaborator

If snap doesn't do it i can think of a few of options. One is to move this into a gatsby project and let it handle the static page generation. While not the worst thing in the world, it would be some work. The other, more hacky solution (which I might add has worked on some really large sites) is to put PHP pages at all of the endpoints and have it include the index and write the correct open graph bits. Gross, but expedient.

@brysonian
Copy link
Copy Markdown
Collaborator

Oh also about that bug, i notice it doesn't happen on https://deploy-preview-45--kind-tesla-a088c1.netlify.app/dalena-tran/ so there is a clue there. If y'all get swaped I can talk a look later tonight.

@hsab
Copy link
Copy Markdown
Collaborator Author

hsab commented May 20, 2020

Oh also about that bug, i notice it doesn't happen on https://deploy-preview-45--kind-tesla-a088c1.netlify.app/dalena-tran/ so there is a clue there. If y'all get swaped I can talk a look later tonight.

I managed to fix the issue by switching from sass to pure css for the blobfield component. It seems to be working correctly if you want to give it a quick test ;)

https://deploy-preview-45--kind-tesla-a088c1.netlify.app/

@hsab
Copy link
Copy Markdown
Collaborator Author

hsab commented May 20, 2020

What I particularly like about this approach. Is that it becomes completely serverless. Also makes life much easier when it comes to archiving and hosting. No messing around with PHP, Apache/nginx, .htaccess etc.

@hsab
Copy link
Copy Markdown
Collaborator Author

hsab commented May 20, 2020

this is proving to be promising!

Screenshot_20200520_125554

Screenshot_20200520_125637

@hsab hsab closed this May 20, 2020
@hsab hsab mentioned this pull request May 20, 2020
@blerchin blerchin deleted the react-snap branch May 22, 2020 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants