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

Feat: Adds generated-at metatag to identify build time #2417

Merged
merged 5 commits into from
Aug 22, 2024

Conversation

emersonlaurentino
Copy link
Member

@emersonlaurentino emersonlaurentino commented Aug 19, 2024

What's the purpose of this pull request?

create a metatag in build time in order to know when the build was created.

How it works?

using the faststore cli we generate a date and insert on store html

How to test it?

finding the generated-at metatag on source code.

Starters Deploy Preview

References

@emersonlaurentino emersonlaurentino self-assigned this Aug 19, 2024
@emersonlaurentino emersonlaurentino requested a review from a team as a code owner August 19, 2024 14:42
@emersonlaurentino emersonlaurentino requested review from renatamottam and lucasfp13 and removed request for a team August 19, 2024 14:42
Copy link

vercel bot commented Aug 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
faststore-site ⬜️ Ignored (Inspect) Visit Preview Aug 22, 2024 6:48pm

@emersonlaurentino emersonlaurentino requested review from hellofanny and removed request for renatamottam August 19, 2024 14:44
Copy link
Contributor

@mateuspontes mateuspontes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's good!
It's important to map the generated at time for better debugging during crises and incidents, like the one we experienced on Aug 15. 🚀

Copy link
Member

@eduardoformiga eduardoformiga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good, but I'll wait to test it afterward and approve :)


// Retrieves the package manager based on the developer lockfile, using `ni`.
export function getPreferredPackageManager() {
const agent = spawnSync("na", ['\?'], { encoding: 'utf8', shell: true }).stdout.trim()
const agent = spawnSync('na', ['?'], {
Copy link
Member

@eduardoformiga eduardoformiga Aug 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the \ removal intentional?

Copy link
Member

@eduardoformiga eduardoformiga Aug 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file adding the default additionalMetaTags to all places with NextSeo, right?

packages/core/tsconfig.json Outdated Show resolved Hide resolved
Copy link

codesandbox-ci bot commented Aug 19, 2024

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.

@hellofanny
Copy link
Contributor

question: I tried looking for the tag in the starter, but I couldn't find it in the preview link. Was I supposed to find it there?

@emersonlaurentino
Copy link
Member Author

emersonlaurentino commented Aug 20, 2024

question: I tried looking for the tag in the vtex-sites/starter.store#510, but I couldn't find it in the preview link. Was I supposed to find it there?

@hellofanny After the build error was fixed, the preview shows the tag?

@hellofanny
Copy link
Contributor

question: I tried looking for the tag in the vtex-sites/starter.store#510, but I couldn't find it in the preview link. Was I supposed to find it there?

@hellofanny After the build error was fixed, the preview shows the tag?

@emersonlaurentino I couldn't see

question: I tried looking for the tag in the vtex-sites/starter.store#510, but I couldn't find it in the preview link. Was I supposed to find it there?

@hellofanny After the build error was fixed, the preview shows the tag?

@emersonlaurentino I've searched again and still couldn't find it

@emersonlaurentino
Copy link
Member Author

question: I tried looking for the tag in the vtex-sites/starter.store#510, but I couldn't find it in the preview link. Was I supposed to find it there?

@hellofanny After the build error was fixed, the preview shows the tag?

@emersonlaurentino I couldn't see

question: I tried looking for the tag in the vtex-sites/starter.store#510, but I couldn't find it in the preview link. Was I supposed to find it there?

@hellofanny After the build error was fixed, the preview shows the tag?

@emersonlaurentino I've searched again and still couldn't find it

Okay, I'll fix it

@emersonlaurentino
Copy link
Member Author

Screenshot 2024-08-22 at 15 50 14

Copy link
Contributor

@hellofanny hellofanny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tag with build time info testing in this preview 🚀

image

@emersonlaurentino emersonlaurentino merged commit 44234ba into main Aug 22, 2024
7 checks passed
@emersonlaurentino emersonlaurentino deleted the feat-generated branch August 22, 2024 19:22
hellofanny added a commit that referenced this pull request Aug 23, 2024
#2417 follow-up.

Adds generated-at metatag on source code to identify when the build was
created.
@hellofanny hellofanny changed the title metatag generated at Feat: Adds generated-at metatag to identify build time Aug 23, 2024
hellofanny added a commit that referenced this pull request Sep 16, 2024
## What's the purpose of this pull request?

Using the next metadata to define the SEO tags.

|before: NextSeo | After: fs-next-update |
|-|-|
|<img width="513" alt="image"
src="https://github.com/user-attachments/assets/bdeef211-d9eb-4fb8-9015-7566eb9c1659">|<img
width="468" alt="image"
src="https://github.com/user-attachments/assets/7c66bbea-9e1a-4cc8-81b7-1a24bc79c971">|

todo: 

- [ ] check duplicate tags
related issue: vercel/next.js#63489
It didn't work for me, I couldn't fix it :/ 
- [ ] after updating the `feat/next-13` branch with `main`, we need to
consider #2417 changes


Regarding the JSON-LD, I added it as recommended in the
[documentation](https://nextjs.org/docs/app/building-your-application/optimizing/metadata#json-ld):
by rendering the structured data as a <script> tag.

I've checked that the generated schema was the same as before and still
valid.
<img width="1520" alt="image"
src="https://github.com/user-attachments/assets/2c01efd0-0110-43c5-b95c-655e24cf0167">

|before: SiteLinksSearchBoxJsonLd | After: fs-next-update |
|-|-|
|<img width="909" alt="image"
src="https://github.com/user-attachments/assets/fda08173-3efa-4317-ab50-d52ca8e640c4">|<img
width="916" alt="image"
src="https://github.com/user-attachments/assets/a1b2af2e-bf53-4a61-9333-c16ba7ffd76b">|

**Question/Curiosity**: Does anyone know how this is being used?

## How to test it?

Navigate to packages/core, run `yarn dev`

**Metatags**
1. Open the [homepage](https://starter.vtex.app/) and inspect the page,
if using chrome, in the `Elements` tab, search for `meta`.
2. In another tab open the homepage: localhost:3000/fs-next-update , do
the same. Inspect and search for `meta`. Compare the tags, you should be
able to see all the tags in the stater here.
___

**JsonLd**
1. Open the [homepage](https://starter.vtex.app/) and inspect the page,
if using chrome, in the `Elements` tab, search for `SearchAction`.
<img width="200" alt="image"
src="https://github.com/user-attachments/assets/9ee2f3d8-cbb4-4183-a979-cc49ece55194">

2. In another tab open the homepage: localhost:3000/fs-next-update , do
the same. Inspect and search for `SearchAction`. Compare the script, it
should the same.


## References

- [SFS
815](https://vtex-dev.atlassian.net/browse/SFS-815?atlOrigin=eyJpIjoiZDMxYTJjYzY0MWZiNDAxZjllYWM1YTVkYWJmMmQ3MjEiLCJwIjoiaiJ9)
- [Nextjs Optimizing Metadata](
https://nextjs.org/docs/app/building-your-application/optimizing/metadata)
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.

5 participants