-
Notifications
You must be signed in to change notification settings - Fork 63
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
feat: search page with SSR #2619
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
packages/core/src/pages/s.tsx
Outdated
@@ -54,13 +55,13 @@ const useSearchParams = ({ | |||
}, [asPath, defaultSort]) | |||
} | |||
|
|||
function Page({ page: searchContentType, globalSections }: Props) { | |||
function Page({ page: searchContentType, globalSections, searchTerm }: Props) { |
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.
Risk: Affected versions of next are vulnerable to Acceptance of Extraneous Untrusted Data With Trusted Data / Authorization Bypass Through User-Controlled Key.
Fix: Upgrade this library to at least version 13.5.7 at faststore/yarn.lock:13689.
Reference(s): GHSA-gp8f-8m3g-qvj9, CVE-2024-46982
💬 To ignore this, reply with:
• /fp <comment>
for false positive
• /ar <comment>
for acceptable risk
• /other <comment>
for all other reasons
Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by ssc-adb055b9-fed0-4d70-a57d-eb9825b09449.
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
packages/core/src/pages/s.tsx
Outdated
title={title} | ||
description={description} | ||
title={`${searchTerm}`} | ||
description={`${searchTerm}: em promoção que você procura? Na Americanas você encontra as melhores ofertas de produtos com entrega rápida. Vem!`} |
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.
dúvida, esse conteúdo aqui o merchant consegue customizar no repositorio dele sem reescrever toda a pagina?
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.
Em teoria sim, mas preciso validar. Pretendo mudar isso no código antes de mergear.
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.
acho que aqui podemos fazer algo similar ao que o NextSeo faz com title e titleTemplate para tornar dinâmico, mas adaptando para description (e criando um desciptionTemplate) com replace.
templateDescription.replace(/%s/g, () => updatedDescription);
packages/core/src/pages/s.tsx
Outdated
title={title} | ||
description={description} | ||
title={`${searchTerm}`} | ||
description={`${searchTerm}: em promoção que você procura? Na Americanas você encontra as melhores ofertas de produtos com entrega rápida. Vem!`} |
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.
acho que aqui podemos fazer algo similar ao que o NextSeo faz com title e titleTemplate para tornar dinâmico, mas adaptando para description (e criando um desciptionTemplate) com replace.
templateDescription.replace(/%s/g, () => updatedDescription);
4bea98c
to
235056a
Compare
function Page({ page: searchContentType, globalSections }: Props) { | ||
type StoreConfig = typeof storeConfig | ||
|
||
function generateSEOData(storeConfig: StoreConfig, searchTerm?: string) { |
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.
Risk: Affected versions of next are vulnerable to Acceptance of Extraneous Untrusted Data With Trusted Data / Authorization Bypass Through User-Controlled Key.
Fix: Upgrade this library to at least version 13.5.7 at faststore/yarn.lock:13689.
Reference(s): GHSA-gp8f-8m3g-qvj9, CVE-2024-46982
💬 To ignore this, reply with:
• /fp <comment>
for false positive
• /ar <comment>
for acceptable risk
• /other <comment>
for all other reasons
Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by ssc-adb055b9-fed0-4d70-a57d-eb9825b09449.
00ed554
to
8a93cbb
Compare
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.
? searchSeo.descriptionTemplate.replace(/%s/g, () => searchTerm) | ||
: seo.description | ||
|
||
const canonical = searchTerm |
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.
should we add the canonical when isSSREnabled as well?
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.
We don't have access to search term in getStaticProps
bb99769
to
bcb8926
Compare
(Don't merge!)
What's the purpose of this pull request?
This POC is an alternative to indexing search pages using server side rendering. As the search page is dynamic and we need to set the title and description based on the search term, we chose to use server side rendering as it is the most suitable for this type of situation.
Nextjs reference:
Like SSG, Server-Side Rendering (SSR) is pre-rendered, which also makes it great for SEO. Instead of being generated at build time, as in SSG, SSR's HTML is generated at request time. This is great for when you have pages that are very dynamic.
https://nextjs.org/learn-pages-router/seo/rendering-and-ranking/rendering-strategies
How it works?
We use the getServerSideProps function instead of getStaticProps. We added a cache header to the response so that it is possible to cache the return in a CDN.
How to test it?
Click on: https://storeframework-cm652ufll028lmgv665a6xv0g-polemunmz.b.vtex.app/s?q=headphone