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(seo): og image #894

Merged
merged 3 commits into from
Sep 19, 2024
Merged

feat(seo): og image #894

merged 3 commits into from
Sep 19, 2024

Conversation

antoinezanardi
Copy link
Owner

@antoinezanardi antoinezanardi commented Sep 19, 2024

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a default Open Graph image component to enhance social media sharing.
    • Added support for multiple languages in Open Graph metadata, improving localization.
    • Integrated new modules for better image generation and development tools.
  • Bug Fixes

    • Updated ESLint configuration to exclude specific files, reducing false positives.
  • Tests

    • Added unit tests for the new Open Graph image component to ensure functionality and visual consistency.

@antoinezanardi antoinezanardi added the 🚀 feature New feature or request label Sep 19, 2024
@antoinezanardi antoinezanardi self-assigned this Sep 19, 2024
Copy link

coderabbitai bot commented Sep 19, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request introduces a new Open Graph image component and functionality to the application, enhancing its social media sharing capabilities. Key changes include the addition of a new Vue component for displaying Open Graph images, updates to localization files for English and French, modifications to ESLint configurations, and enhancements to the Nuxt.js configuration for image generation. Additionally, new dependencies are added to support these features, along with unit tests for the new component.

Changes

File Change Summary
app/app.vue Added function call defineOgImageComponent("DefaultOgImage") to define a default Open Graph image component.
app/components/OgImage/DefaultOgImage.vue Introduced a new component with a structured template for Open Graph images, utilizing specific styles and internationalization.
config/eslint/flat-configs/eslint.global-config.mjs Added defineOgImageComponent as a READONLY property to ESLINT_GLOBAL_CONFIG.
config/eslint/flat-configs/eslint.vue-config.mjs Excluded DefaultOgImage.vue from ESLint checks by adding it to the ignores array.
modules/i18n/locales/en.json Added DefaultOgImage entity with title and description for English localization.
modules/i18n/locales/fr.json Added DefaultOgImage entity with title and description for French localization.
nuxt.config.ts Added nuxt-og-image module and updated ogImage configuration for Open Graph image generation.
package.json Added dependencies @nuxt/devtools and nuxt-og-image to enhance development and social media integration.
tests/unit/specs/components/OgImage/DefaultOgImage/DefaultOgImage.nuxt.spec.ts Created unit tests for the DefaultOgImage component, including snapshot testing.
tests/unit/utils/factories/composables/nuxt/useRuntimeConfig.factory.ts Added configuration object for nuxt-og-image module in the createFakeRuntimeConfig function.

Possibly related PRs

Poem

In the meadow where the rabbits play,
New images brighten the social way.
With titles and tales in both tongues,
Sharing our stories, the joy just hums.
So hop along, let the good times roll,
Open Graph magic, filling every hole! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (2)
nuxt.config.ts (1)

20-20: Consider moving this change to a separate PR.

The addition of the @nuxt/devtools module is a good change that enhances the development experience. However, it is not directly related to the PR objective of adding OG image support.

Consider moving this change to a separate PR to keep the changes focused and maintainable.

app/components/OgImage/DefaultOgImage.vue (1)

25-26: Consider removing the empty <script setup> section.

Since there is no JavaScript logic or component setup required, the empty <script setup> section can be removed to keep the code clean and concise.

In Vue 3, the <script setup> section is optional when there is no JavaScript code to be executed.

Apply this diff to remove the empty <script setup> section:

-<script setup>
-</script>
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 36cce97 and 850c9bc.

Files ignored due to path filters (2)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • tests/unit/specs/components/OgImage/DefaultOgImage/__snapshots__/DefaultOgImage.nuxt.spec.ts.snap is excluded by !**/*.snap
Files selected for processing (10)
  • app/app.vue (1 hunks)
  • app/components/OgImage/DefaultOgImage.vue (1 hunks)
  • config/eslint/flat-configs/eslint.global-config.mjs (1 hunks)
  • config/eslint/flat-configs/eslint.vue-config.mjs (1 hunks)
  • modules/i18n/locales/en.json (1 hunks)
  • modules/i18n/locales/fr.json (1 hunks)
  • nuxt.config.ts (2 hunks)
  • package.json (2 hunks)
  • tests/unit/specs/components/OgImage/DefaultOgImage/DefaultOgImage.nuxt.spec.ts (1 hunks)
  • tests/unit/utils/factories/composables/nuxt/useRuntimeConfig.factory.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • config/eslint/flat-configs/eslint.vue-config.mjs
  • modules/i18n/locales/fr.json
Additional comments not posted (17)
tests/unit/specs/components/OgImage/DefaultOgImage/DefaultOgImage.nuxt.spec.ts (4)

1-5: LGTM!

The import statements are correctly used to bring in the necessary dependencies for testing the DefaultOgImage component.


7-13: LGTM!

The describe block and the mountDefaultOgImageComponent function are correctly set up to facilitate testing the DefaultOgImage component.


15-17: LGTM!

The beforeEach hook correctly mounts a fresh instance of the DefaultOgImage component before each test using the mountDefaultOgImageComponent function.


19-22: LGTM!

The test case correctly verifies that the DefaultOgImage component renders as expected by checking the truthiness of the wrapper and matching the rendered HTML against a stored snapshot.

app/app.vue (1)

33-34: LGTM!

The addition of the defineOgImageComponent("DefaultOgImages") function call aligns with the PR objective of adding an og image. This change can enhance the application's social media sharing capabilities by ensuring that a specific image is used when content is shared, thereby improving the visual representation of the application on platforms that utilize Open Graph metadata.

tests/unit/utils/factories/composables/nuxt/useRuntimeConfig.factory.ts (1)

123-144: LGTM!

The addition of the "nuxt-og-image" configuration object to the createFakeRuntimeConfig function is well-structured and comprehensive. It provides a wide range of settings for the module, allowing for granular control over its behavior.

The properties in the configuration object are related to the module and follow a consistent naming convention. The defaults object is a nice touch, providing default values for specific properties used by the module.

Overall, this enhancement expands the functionality of the runtime configuration by accommodating the specific needs of the "nuxt-og-image" module.

nuxt.config.ts (3)

17-17: LGTM!

The addition of the nuxt-og-image module aligns with the PR objective and enables Open Graph image generation.


79-79: Please clarify the reason for this change and its impact.

The buildCache option in the experimental settings has been changed from true to false. This change could potentially affect build performance and behavior during development.

Please provide more context on the reason for this change and its expected impact on the project.


81-89: LGTM!

The addition of the ogImage configuration aligns with the PR objective and enables Open Graph image generation based on the environment. The specified font weights will be used in the generated images.

config/eslint/flat-configs/eslint.global-config.mjs (1)

35-35: LGTM!

The addition of the defineOgImageComponent property to the ESLINT_GLOBAL_CONFIG object is a good enhancement to the ESLint configuration. Marking it as READONLY is also a good practice to prevent unintended modifications.

This change aligns well with the PR objective of adding support for Open Graph images and is unlikely to introduce any issues.

package.json (2)

88-88: LGTM!

Adding @nuxt/devtools can enhance the development experience by providing useful debugging and inspection tools for Nuxt applications.


146-146: Looks good! Remember to configure and test the Open Graph images.

Adding nuxt-og-image can improve the application's social media sharing capabilities by generating Open Graph images. Please ensure that the generated images are properly configured and tested for various social media platforms.

app/components/OgImage/DefaultOgImage.vue (4)

1-24: The template structure looks good!

The template defines a well-structured layout for the default OG image component. It effectively uses Tailwind CSS classes for styling and positioning of elements. The usage of $t function for internationalization of the heading content is a good practice.


6-10: Base64-encoded image usage is acceptable here.

While using base64-encoded images directly in the template can increase the bundle size, it can be justified for a one-time use case like an OG image. It eliminates the need for an additional network request to fetch the image file.

However, if this image is reused in multiple places, consider extracting it to an external file.


12-14: Heading styling looks good!

The usage of Tailwind CSS classes for styling the <h1> element is appropriate. The font-black class provides the necessary font weight for a heading, and the shadow-md and shadow-yellow-500 classes add a nice visual effect.

The custom font size of 4rem using arbitrary values is a valid approach in Tailwind CSS.


18-20: Subheading styling is consistent.

The styling of the <h3> element is consistent with the <h1> element, which maintains a cohesive design. The usage of font-bold for font weight and leading-relaxed for line height is suitable for a subheading.

The shadow and text color classes are reused from the <h1> element, ensuring consistency.

modules/i18n/locales/en.json (1)

1614-1616: LGTM!

The addition of the DefaultOgImage entity with title and description properties is a good way to provide metadata for Open Graph tags. This will help generate rich link previews when sharing the Werewolves Assistant on social media platforms. The chosen title and description accurately represent the tool.

Copy link

sonarcloud bot commented Sep 19, 2024

@antoinezanardi antoinezanardi merged commit 1ee976a into develop Sep 19, 2024
15 checks passed
@antoinezanardi antoinezanardi deleted the feat/og-image branch September 19, 2024 16:13
antoinezanardi pushed a commit that referenced this pull request Oct 1, 2024
## [1.33.0](v1.32.0...v1.33.0) (2024-10-01)

### 🚀 Features

* **game-lobby:** player group organizer ([#893](#893)) ([83c76d8](83c76d8))
* **game:** prejudiced manipulator groups and victory screen ([#929](#929)) ([5a42531](5a42531))
* **positions-coordinator:** add helper for sorting positions ([#892](#892)) ([36cce97](36cce97))
* **seo:** og image ([#894](#894)) ([1ee976a](1ee976a))

### 🎨 Styles

* **accordion:** better expand and collapse icons ([#937](#937)) ([97b7ada](97b7ada))

### ⚡️ Performances

* **images:** better placeholder for images ([#936](#936)) ([df88300](df88300))

### ✅ Tests

* **speed:** improve test speed with shards and threads ([#928](#928)) ([3480fd2](3480fd2))

### 🧹 Chore

* **deps:** replace dependency eslint-plugin-vitest with @vitest/eslint-plugin ^1.0.1 ([#916](#916)) ([c8acbbe](c8acbbe))
* **deps:** update antoinezanardi/werewolves-assistant-api docker tag to v1.36.2 ([#890](#890)) ([8425de2](8425de2))
* **deps:** update dependency @faker-js/faker to ^9.0.2 ([#912](#912)) ([0566528](0566528))
* **deps:** update dependency @faker-js/faker to ^9.0.3 ([#915](#915)) ([6272855](6272855))
* **deps:** update dependency @nuxt/devtools to ^1.5.0 ([#900](#900)) ([4412f14](4412f14))
* **deps:** update dependency @nuxt/devtools to ^1.5.1 ([#913](#913)) ([2b66521](2b66521))
* **deps:** update dependency @nuxtjs/i18n to ^8.5.4 ([#896](#896)) ([7d1d599](7d1d599))
* **deps:** update dependency @nuxtjs/i18n to ^8.5.5 ([#906](#906)) ([6555c17](6555c17))
* **deps:** update dependency @nuxtjs/seo to ^2.0.0-rc.23 ([#920](#920)) ([c84cf63](c84cf63))
* **deps:** update dependency @nuxtjs/sitemap to ^6.1.0 ([#898](#898)) ([f63c128](f63c128))
* **deps:** update dependency @nuxtjs/sitemap to ^6.1.1 ([#917](#917)) ([c61da65](c61da65))
* **deps:** update dependency @pinia/nuxt to ^0.5.5 ([#930](#930)) ([bea1f85](bea1f85))
* **deps:** update dependency @pinia/testing to ^0.1.6 ([#931](#931)) ([2004a14](2004a14))
* **deps:** update dependency @types/howler to ^2.2.12 ([#909](#909)) ([b318370](b318370))
* **deps:** update dependency @vitest/eslint-plugin to ^1.1.4 ([#927](#927)) ([b9c9811](b9c9811))
* **deps:** update dependency cucumber-html-reporter to ^7.2.0 ([#935](#935)) ([042d4b0](042d4b0))
* **deps:** update dependency eslint to ^9.11.0 ([#904](#904)) ([7d98b4f](7d98b4f))
* **deps:** update dependency eslint to ^9.11.1 ([#911](#911)) ([2b5e37b](2b5e37b))
* **deps:** update dependency msw to ^2.4.9 ([#897](#897)) ([8e7eee4](8e7eee4))
* **deps:** update dependency nuxt-og-image to ^3.0.3 ([#922](#922)) ([8d0c2c3](8d0c2c3))
* **deps:** update dependency nuxt-og-image to ^3.0.4 ([#923](#923)) ([3250087](3250087))
* **deps:** update dependency ofetch to ^1.4.0 ([#905](#905)) ([bfe7b67](bfe7b67))
* **deps:** update dependency pinia to ^2.2.3 ([#932](#932)) ([755572c](755572c))
* **deps:** update dependency pinia to ^2.2.4 ([#934](#934)) ([1d5ac2b](1d5ac2b))
* **deps:** update dependency sass to ^1.79.2 ([#895](#895)) ([9c0893b](9c0893b))
* **deps:** update dependency sass to ^1.79.3 ([#903](#903)) ([5b34d74](5b34d74))
* **deps:** update dependency sass to ^1.79.4 ([#919](#919)) ([1422380](1422380))
* **deps:** update dependency semantic-release to ^24.1.2 ([#918](#918)) ([ee29ec1](ee29ec1))
* **deps:** update dependency tailwindcss to ^3.4.13 ([#908](#908)) ([25be207](25be207))
* **deps:** update dependency ts-case-convert to ^2.1.0 ([#924](#924)) ([345c432](345c432))
* **deps:** update dependency vue to ^3.5.10 ([#914](#914)) ([15a32d3](15a32d3))
* **deps:** update dependency vue to ^3.5.7 ([#901](#901)) ([bc652b1](bc652b1))
* **deps:** update dependency vue to ^3.5.8 ([#907](#907)) ([2b901f5](2b901f5))
* **deps:** update playwright monorepo to ^1.47.2 ([#902](#902)) ([a1984f2](a1984f2))
* **deps:** update pnpm to v9.11.0 ([#899](#899)) ([b94c5b5](b94c5b5))
* **deps:** update stryker-js monorepo to ^8.6.0 ([#925](#925)) ([1c993e8](1c993e8))
* **deps:** update typescript-eslint monorepo to ^8.7.0 ([#910](#910)) ([1fb5c34](1fb5c34))
* **deps:** update typescript-eslint monorepo to ^8.8.0 ([#933](#933)) ([026e00b](026e00b))
* **link-checker:** remove useless dep ([#926](#926)) ([9916e51](9916e51))
@antoinezanardi
Copy link
Owner Author

🎉 This PR is included in version 1.33.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 feature New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant