-
Notifications
You must be signed in to change notification settings - Fork 0
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
Pre-rendered seo #46
Pre-rendered seo #46
Changes from 3 commits
05cb69e
7aca5d7
7767417
5f2e343
35e0e93
c1b9b4d
25c71e8
05a1d29
61d2090
481c551
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ import { useHistory } from "react-router-dom"; | |
import config from "src/config"; | ||
import paper from "paper"; | ||
|
||
import style from "./style.module.scss"; | ||
import './style-blobs.css'; | ||
import Blobs from "./blobs"; | ||
|
||
import ArtistNav from "../Components/ArtistNav/"; | ||
|
@@ -105,9 +105,9 @@ export default function BlobField({ collapsed = false }) { | |
|
||
return ( | ||
<div | ||
className={style.wrapper} | ||
className='blobs-wrapper' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again fixing styling when entering the homepage from an external link or by typing in the address bar. #46 (comment) |
||
ref={wrapperEl} | ||
style={collapsed ? {} : { width: parentWidth, height: parentHeight }} | ||
// style={collapsed ? {} : { width: parentWidth, height: parentHeight }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
> | ||
<ArtistNav /> | ||
<canvas ref={animationEl}/> | ||
|
@@ -122,7 +122,7 @@ export default function BlobField({ collapsed = false }) { | |
: "NEARREST NEIGHBOR"} | ||
</div> | ||
)} | ||
<div className={style.popover} style={popoverStyle}> | ||
<div className='blobs-popover' style={popoverStyle}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
{collapsed && activeArtist ? activeArtist.name.toUpperCase() : ""} | ||
</div> | ||
</div> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
.wrapper { | ||
.blobs-wrapper { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changing from SASS to pure CSS #46 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did you try this with the modules in place? I'm wondering if it was actually sass that was breaking it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm gonna give it a try and report back. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No success :( I found:
There's also the following in my console during dev preview:
Wondering if this has to do with that lingering There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok. i can take a look after the lecture tonight There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey managed to narrow down the issue to |
||
display: flex; | ||
height: 100%; | ||
justify-content: center; | ||
flex-direction: column; | ||
position: relative; | ||
width: 100%; | ||
svg, canvas { | ||
position: fixed; | ||
bottom: 0; | ||
// left: 0; | ||
right: 0; | ||
// top: 0; | ||
z-index: 999; | ||
} | ||
} | ||
|
||
.blobs-wrapper > svg, canvas { | ||
position: fixed; | ||
bottom: 0; | ||
/* left: 0; */ | ||
right: 0; | ||
/* top: 0; */ | ||
z-index: 999; | ||
} | ||
|
||
.popover{ | ||
.blobs-popover{ | ||
position: fixed; | ||
z-index: 9999; | ||
transform: translate(0, -50%); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// https://github.com/stereobooster/react-snap/blob/master/doc/recipes.md | ||
// From https://github.com/stereobooster/an-almost-static-stack/blob/react-snap/src/components/Seo.js | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import {Helmet} from "react-helmet"; | ||
|
||
const absoluteUrl = path => `https://deploy-preview-46--kind-tesla-a088c1.netlify.app/${path}`; | ||
const seoImageURL = file => `https://deploy-preview-46--kind-tesla-a088c1.netlify.app${file}`; | ||
|
||
const getMetaTags = ({ | ||
title, description, url, contentType, published, updated, category, tags, twitter, image, | ||
}) => { | ||
const metaTags = [ | ||
{ itemprop: 'name', content: title }, | ||
{ itemprop: 'description', content: description ? description : 'Online MFA show for 2020 DMA grads.'}, | ||
{ name: 'description', content: description ? description : 'Online MFA show for 2020 DMA grads.'}, | ||
{ name: 'twitter:site', content: twitter}, | ||
{ name: 'twitter:title', content: `${title} | NEARREST NEIGHBOR` }, | ||
{ name: 'twitter:description', content: description }, | ||
{ name: 'twitter:creator', content: twitter}, | ||
{ property: 'og:title', content: `${title} | NEARREST NEIGHBOR` }, | ||
{ property: 'og:type', content: contentType }, //https://ogp.me/#types | ||
{ property: 'og:url', content: url }, | ||
{ property: 'og:description', content: description }, | ||
{ property: 'og:site_name', content: 'NEARREST NEIGHBOR' }, | ||
{ property: 'og:locale', content: 'en_EN' }, | ||
// { name: 'fb:app_id', content: '<FB App ID>' }, | ||
]; | ||
|
||
if (published) metaTags.push({ name: 'article:published_time', content: published }); | ||
if (updated) metaTags.push({ name: 'article:modified_time', content: updated }); | ||
if (category) metaTags.push({ name: 'article:section', content: category }); | ||
if (tags) metaTags.push({ name: 'article:tag', content: tags }); | ||
if (image) { | ||
metaTags.push({ itemprop: 'image', content: seoImageURL(image) }); | ||
metaTags.push({ name: 'twitter:image:src', content: seoImageURL(image) }); | ||
metaTags.push({ property: 'og:image', content: seoImageURL(image) }); | ||
metaTags.push({ name: 'twitter:card', content: 'summary_large_image' }); | ||
} else { | ||
metaTags.push({ name: 'twitter:card', content: 'summary' }); | ||
} | ||
|
||
return metaTags; | ||
}; | ||
|
||
const getHtmlAttributes = ({ | ||
schema | ||
}) => { | ||
let result = { | ||
lang: 'en', | ||
}; | ||
if (schema) { | ||
result = { | ||
...result, | ||
itemscope: undefined, | ||
itemtype: `http://schema.org/${schema}`, | ||
} | ||
} | ||
return result; | ||
} | ||
|
||
getHtmlAttributes.propTypes = { | ||
schema: PropTypes.string, | ||
}; | ||
|
||
const Seo = ({ | ||
schema, title, description, path, contentType, published, updated, category, tags, twitter, image | ||
}) => ( | ||
<Helmet | ||
htmlAttributes={getHtmlAttributes({ | ||
schema, | ||
})} | ||
title={ `${title} | NEARREST NEIGHBOR`} | ||
link={[ | ||
{ rel: 'canonical', href: absoluteUrl(path) }, | ||
]} | ||
meta={getMetaTags({ | ||
title, | ||
description, | ||
contentType, | ||
url: absoluteUrl(path), | ||
published, | ||
updated, | ||
category, | ||
tags, | ||
twitter, | ||
image: image ? image.images[image.images.length - 1].path : 'FALLBACKIMAGE' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
})} | ||
/> | ||
); | ||
|
||
Seo.propTypes = { | ||
schema: PropTypes.string, | ||
title: PropTypes.string, | ||
description: PropTypes.string, | ||
path: PropTypes.string, | ||
contentType: PropTypes.string, | ||
published: PropTypes.string, | ||
updated: PropTypes.string, | ||
category: PropTypes.string, | ||
tags: PropTypes.array, | ||
twitter: PropTypes.string, | ||
image: PropTypes.object, | ||
}; | ||
|
||
export default Seo; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,11 +11,11 @@ export default () => ( | |
<Suspense fallback={<div />}> | ||
<Switch> | ||
{ | ||
config.artists.map(({slug, component}) => { | ||
config.artists.map(({slug, component}, i) => { | ||
const Comp = lazy(() => import(`../../work/${component}`)); | ||
return ( | ||
<Route path={`/${slug}`} key={slug}> | ||
<Comp /> | ||
<Comp config={config.artists[i]}/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Passing the config data to the artist component to automatically infer the path and title. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'm not sure if this will do what is intended. Lazy is used to code split the bundle, so each artist has their own js file instead of loading them all at once. Or is this just to pass the SEO metadata? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is to just pass the SEO data from the config to the component. I'm not sure if what I'm doing is right. But the styling issue existed even when I had the metadata hardcoded with this file unmodified. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. weird. lets see how removing sass goes and then i can poke around if you want. If the site is going to be static though you could remove the lazy stuff entirely since it won't help too much. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like snap supports webpack chunks. Is this what Lazy uses? Based on what I know snap is only semi-static and still depends on being hydrated, generating the most basic html needed for pre-rendering. Wonder if chunks help in this regard. Also glancing over the generated artist htmls I see a lot of |
||
</Route> | ||
) | ||
}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,8 @@ body { | |
font-family: sans-serif; | ||
font-weight: 700; | ||
line-height: initial; | ||
margin-top: 50vh; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again fixing styling when entering the homepage from and external link or by typing in the address bar. Translation is to accommodate centering in the absence of |
||
transform: translateY(-50%); | ||
} | ||
|
||
.blobs { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,69 @@ | ||
import React from 'react'; | ||
import React from "react"; | ||
|
||
import Artist from '../Containers/Artist'; | ||
import ProjectCover from '../Components/ProjectCover'; | ||
import ProjectHeader from '../Components/ProjectHeader'; | ||
import ArtistBio from '../Components/ArtistBio'; | ||
import ProjectColumns, { Column } from '../Components/ProjectColumns'; | ||
import Image from '../Components/Image'; | ||
import Vimeo from '../Components/VideoVimeo' | ||
import Artist from "../Containers/Artist"; | ||
import ProjectCover from "../Components/ProjectCover"; | ||
import ProjectHeader from "../Components/ProjectHeader"; | ||
import ArtistBio from "../Components/ArtistBio"; | ||
import ProjectColumns, { Column } from "../Components/ProjectColumns"; | ||
import Image from "../Components/Image"; | ||
import Vimeo from "../Components/VideoVimeo"; | ||
|
||
import BenImage from './assets/BenLerchin-yimby-cover.jpg'; | ||
import Placeholder from './assets/placeholder.png'; | ||
import BenImage from "./assets/BenLerchin-yimby-cover.jpg"; | ||
import Placeholder from "./assets/placeholder.png"; | ||
|
||
export default function() { | ||
return ( | ||
<Artist> | ||
<ProjectHeader | ||
artistName="Ben Lerchin" | ||
title="Yes, in my Backyard" | ||
materials="10 minute video" | ||
link="http://benlerchin.com" | ||
/> | ||
<ProjectCover> | ||
<Image | ||
img={BenImage} | ||
alt='Still from video. A gray industrial concrete and metal box is in the foreground, with the text | ||
import Seo from "../Components/Seo"; | ||
export default function (config) { | ||
return ( | ||
<Artist> | ||
<Seo | ||
title={config.config.name} | ||
description="Scelerisque venenatis nibh fames ad quam feugiat leo commodo vitae sed lacus." | ||
path={config.config.slug} | ||
image={BenImage} | ||
/> | ||
<ProjectHeader | ||
artistName="Ben Lerchin" | ||
title="Yes, in my Backyard" | ||
materials="10 minute video" | ||
link="http://benlerchin.com" | ||
/> | ||
<ProjectCover> | ||
<Image | ||
img={BenImage} | ||
alt='Still from video. A gray industrial concrete and metal box is in the foreground, with the text | ||
"MILE 103" obliquely visible. Low brush growth is seen in the near background, behind which a number | ||
of wind turbines are visible.' | ||
/> | ||
</ProjectCover> | ||
<ProjectColumns> | ||
<Column> | ||
<Vimeo | ||
url="https://player.vimeo.com/video/TK?color=ffffff&title=0&byline=0&portrait=0" | ||
/> | ||
</Column> | ||
</ProjectColumns> | ||
<ProjectColumns> | ||
<Column> | ||
<p> | ||
Semi-satirical mockumentary reframing Los Angeles' infrastructure as a tourist destination for nature-lovers. | ||
</p> | ||
</Column> | ||
</ProjectColumns> | ||
<ArtistBio> | ||
<p> | ||
Ben Lerchin is an artist and technologist who works with software, photography, and digital fabrication. Their practice deals extensively with the relationship between the photographic image and the American West. Reflecting on the uneasy experience of living between the city and the wilderness, my work attempts to reconcile a networked, industrialized lifestyle with the unstable ground under our feet. It is an attempt to erase boundaries with the natural world, and to see it not as victim nor antagonist, but as co-conspirator and friend. Using digital photographic processes, Ben embeds a polyphony of viewpoints into three dimensional forms reminiscent of the landscape from which they emerge, showing sites of resource management in relation to the people that depend on them. | ||
</p> | ||
</ArtistBio> | ||
</Artist> | ||
); | ||
} | ||
/> | ||
</ProjectCover> | ||
<ProjectColumns> | ||
<Column> | ||
<Vimeo url="https://player.vimeo.com/video/TK?color=ffffff&title=0&byline=0&portrait=0" /> | ||
</Column> | ||
</ProjectColumns> | ||
<ProjectColumns> | ||
<Column> | ||
<p> | ||
Semi-satirical mockumentary reframing Los Angeles' infrastructure as | ||
a tourist destination for nature-lovers. | ||
</p> | ||
</Column> | ||
</ProjectColumns> | ||
<ArtistBio> | ||
<p> | ||
Ben Lerchin is an artist and technologist who works with software, | ||
photography, and digital fabrication. Their practice deals extensively | ||
with the relationship between the photographic image and the American | ||
West. Reflecting on the uneasy experience of living between the city | ||
and the wilderness, my work attempts to reconcile a networked, | ||
industrialized lifestyle with the unstable ground under our feet. It | ||
is an attempt to erase boundaries with the natural world, and to see | ||
it not as victim nor antagonist, but as co-conspirator and friend. | ||
Using digital photographic processes, Ben embeds a polyphony of | ||
viewpoints into three dimensional forms reminiscent of the landscape | ||
from which they emerge, showing sites of resource management in | ||
relation to the people that depend on them. | ||
</p> | ||
</ArtistBio> | ||
</Artist> | ||
); | ||
} |
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.
This managed to fix the styling when the user enters the homepage from and external link or by typing in the address bar.
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.
very strange that this would happen here and not break the other components that use css modules.
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.
Yeah exactly my thought.
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.
I can't reproduce this. I renamed style-blobs.css to style.module.css, removed
blobs-
from the style names. and thenin the index.js and then
className={wrapper}
etc and the correct styles are being applied. It does appear asstyle_wrapper__1dMCn
but that's just the generated name from the css modules. The content of the class is accurate.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.
or was this only happening on Production? Just realized that
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.
This is happening in production. Also I have temporarily fixed it by removing the class assignment on PageHeader. Have a look at the last commit when you can 7767417