Skip to content

Add reusable social preview image and metadata - #7

Merged
AlexanderWagnerDev merged 2 commits into
mainfrom
agent/social-preview
Jul 26, 2026
Merged

Add reusable social preview image and metadata#7
AlexanderWagnerDev merged 2 commits into
mainfrom
agent/social-preview

Conversation

@AlexanderWagnerDev

@AlexanderWagnerDev AlexanderWagnerDev commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

What changed

  • add a lightweight 1200×630 OpenRTMP social preview image under assets/img/
  • distinguish the librtmp2 Rust library from the self-hosted server and panel in the artwork
  • add overridable $socialImage, dimensions, and alt-text defaults in includes/header.php
  • emit Open Graph image metadata and Twitter large-card metadata

Validation

  • php -l includes/header.php
  • verified generated metadata for the homepage, /quickstart/, and /guides/self-hosted-rtmp-server-docker/
  • confirmed the PNG is 1200×630 and optimized for web delivery

Closes #3


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@AlexanderWagnerDev, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Free

Run ID: 5a5a0338-c769-4a99-9518-99c8ed611607

📥 Commits

Reviewing files that changed from the base of the PR and between e333284 and fceae22.

⛔ Files ignored due to path filters (1)
  • assets/img/social-preview.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • includes/header.php

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands.

@AlexanderWagnerDev
AlexanderWagnerDev marked this pull request as ready for review July 26, 2026 20:21
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add social preview image and Open Graph/Twitter metadata

✨ Enhancement 🕐 10-20 Minutes

Grey Divider

AI Description

• Add a reusable 1200×630 social preview image asset for consistent link previews.
• Introduce overridable social image URL, dimensions, and alt-text defaults in the global header.
• Emit Open Graph image tags and Twitter large-card metadata across site pages.
Diagram

graph TD; Page["Page template"] --> Header["includes/header.php"] --> Meta["OG/Twitter meta"] --> Crawler{{"Social crawler"}} --> Image["assets/img/social-preview.png"]
Loading
High-Level Assessment

The PR’s approach (global defaults in the shared header with per-page override variables, plus standard OG/Twitter tags) is the simplest and most maintainable way to get consistent previews across the site. Alternatives like per-page hardcoding, multiple image variants, or environment-driven host configuration add complexity without clear benefit for the current static site setup.

Files changed (2) +11 / -1 · 1 not counted

Enhancement (2) +11 / -1
social-preview.pngAdd default 1200×630 social preview image not counted

Add default 1200×630 social preview image

• Introduces a new PNG asset sized for common Open Graph/Twitter preview requirements. The artwork distinguishes the Rust librtmp2 library from the self-hosted server/panel branding.

assets/img/social-preview.png

header.phpEmit OG image + Twitter large-card metadata with overrides +11/-1

Emit OG image + Twitter large-card metadata with overrides

• Adds overridable defaults for social image URL, width/height, and alt text. Updates the head markup to output og:image (plus width/height/alt) and switches Twitter cards to summary_large_image with matching image and alt tags.

includes/header.php

@qodo-code-review

qodo-code-review Bot commented Jul 26, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Invalid OG image dimensions 🐞 Bug ≡ Correctness
Description
$socialImageWidth/$socialImageHeight are output as integers without validating they are positive, so
a non-null but invalid override (e.g., empty string) bypasses the ?? defaults and can emit 0/invalid
og:image:width/height metadata. This can cause social parsers to ignore or mis-handle the image
dimensions for pages that override these values incorrectly.
Code

includes/header.php[R30-31]

+<meta property="og:image:width" content="<?php echo (int) $socialImageWidth; ?>">
+<meta property="og:image:height" content="<?php echo (int) $socialImageHeight; ?>">
Evidence
Defaults are applied only when the variable is null/undefined, but the output casts whatever value
is present to int. This combination means non-null invalid overrides can become 0 in the rendered
og:image dimension tags.

includes/header.php[10-13]
includes/header.php[29-31]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`$socialImageWidth` and `$socialImageHeight` are emitted as integers but are not validated to be positive integers. Because the defaults use `??`, any non-null invalid value (e.g., `''`, `false`, `'abc'`) will bypass the default and then be cast to `0`, producing invalid Open Graph dimension metadata.

## Issue Context
Pages currently don’t override these variables, but the PR explicitly makes them overridable. Defensive validation prevents future callers/config from unintentionally emitting invalid metadata.

## Fix Focus Areas
- includes/header.php[10-13]
- includes/header.php[29-31]

## Suggested change
Before emitting the meta tags, normalize the values to positive ints (fallback to 1200/630 when invalid), e.g.:
- If `!is_int($socialImageWidth)`/`!ctype_digit((string)$socialImageWidth)` or `(int)$socialImageWidth <= 0`, set to `1200`
- Same for height with `630`

Keep the `(int)` cast in output after validation.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Previous review results

Review updated until commit fceae22 ⚖️ Balanced

Results up to commit cdb164c ⚖️ Balanced


No changes from previous review

Qodo Logo

@AlexanderWagnerDev
AlexanderWagnerDev merged commit 85b0597 into main Jul 26, 2026
2 checks passed
@AlexanderWagnerDev
AlexanderWagnerDev deleted the agent/social-preview branch July 26, 2026 20:24
@sonarqubecloud

Copy link
Copy Markdown

Comment thread includes/header.php
Comment on lines +30 to +31
<meta property="og:image:width" content="<?php echo (int) $socialImageWidth; ?>">
<meta property="og:image:height" content="<?php echo (int) $socialImageHeight; ?>">

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

1. Invalid og image dimensions 🐞 Bug ≡ Correctness

$socialImageWidth/$socialImageHeight are output as integers without validating they are positive, so
a non-null but invalid override (e.g., empty string) bypasses the ?? defaults and can emit 0/invalid
og:image:width/height metadata. This can cause social parsers to ignore or mis-handle the image
dimensions for pages that override these values incorrectly.
Agent Prompt
## Issue description
`$socialImageWidth` and `$socialImageHeight` are emitted as integers but are not validated to be positive integers. Because the defaults use `??`, any non-null invalid value (e.g., `''`, `false`, `'abc'`) will bypass the default and then be cast to `0`, producing invalid Open Graph dimension metadata.

## Issue Context
Pages currently don’t override these variables, but the PR explicitly makes them overridable. Defensive validation prevents future callers/config from unintentionally emitting invalid metadata.

## Fix Focus Areas
- includes/header.php[10-13]
- includes/header.php[29-31]

## Suggested change
Before emitting the meta tags, normalize the values to positive ints (fallback to 1200/630 when invalid), e.g.:
- If `!is_int($socialImageWidth)`/`!ctype_digit((string)$socialImageWidth)` or `(int)$socialImageWidth <= 0`, set to `1200`
- Same for height with `630`

Keep the `(int)` cast in output after validation.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit fceae22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

design: add a reusable social preview image for OpenRTMP pages

1 participant