PHPackages                             ernestdefoe/og-image - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ernestdefoe/og-image

ActiveFlarum-extension[Utility &amp; Helpers](/categories/utility)

ernestdefoe/og-image
====================

Adds Open Graph and Twitter Card meta tags to Flarum 2 discussions for rich Facebook and social media previews

v2.0.7(1w ago)0108↓100%MITPHPPHP ^8.3CI passing

Since May 10Pushed 1w agoCompare

[ Source](https://github.com/ernestdefoe/og-image)[ Packagist](https://packagist.org/packages/ernestdefoe/og-image)[ RSS](/packages/ernestdefoe-og-image/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (8)Dependencies (1)Versions (9)Used By (0)

Flarum OG Image
===============

[](#flarum-og-image)

[![Floxum](https://camo.githubusercontent.com/62e404a70166404c300084271d2791d38a9b06c65a92a63fef803d5732a725d2/68747470733a2f2f666c6f78756d2e636f6d2f657874656e73696f6e2f65726e6573746465666f652f6f672d696d6167652f62616467652f6e616d65)](https://floxum.com/extension/ernestdefoe/og-image)[![Version](https://camo.githubusercontent.com/507285e1d607a4c8f9c75c8a381b872065e1bb29c7774fcb38dc3affcb3e6b36/68747470733a2f2f666c6f78756d2e636f6d2f657874656e73696f6e2f65726e6573746465666f652f6f672d696d6167652f62616467652f686967686573742d76657273696f6e)](https://floxum.com/extension/ernestdefoe/og-image)[![Downloads](https://camo.githubusercontent.com/fe2509d561db3415f9073c702abe16e0661e73bd74953b09106568f22183bb74/68747470733a2f2f666c6f78756d2e636f6d2f657874656e73696f6e2f65726e6573746465666f652f6f672d696d6167652f62616467652f646f776e6c6f616473)](https://floxum.com/extension/ernestdefoe/og-image)[![Review](https://camo.githubusercontent.com/40d613875b0fcc5aa4bb47e52b9026b18aba152eb2fc770bb796596e6c0af1a9/68747470733a2f2f666c6f78756d2e636f6d2f657874656e73696f6e2f65726e6573746465666f652f6f672d696d6167652f62616467652f726576696577)](https://floxum.com/extension/ernestdefoe/og-image)[![License](https://camo.githubusercontent.com/9f8b1dc981f800161fc4eefedcbc9c2edd3e15a292f85a02f7735f89becb1949/68747470733a2f2f666c6f78756d2e636f6d2f657874656e73696f6e2f65726e6573746465666f652f6f672d696d6167652f62616467652f6c6963656e7365)](https://floxum.com/extension/ernestdefoe/og-image)

Automatically adds Open Graph and Twitter Card meta tags to every page of your Flarum 2 forum so that Facebook, Twitter/X, and other platforms generate rich link previews when discussions are shared or auto-posted.

---

What it does
------------

[](#what-it-does)

PageTags generatedDiscussion`og:title`, `og:description`, `og:image`, `og:url`, `og:type`, `article:published_time`, Twitter CardForum index / other pages`og:title`, `og:description`, `og:image`, `og:url`, `og:type`, Twitter CardAll pages`og:site_name`, `fb:app_id` (if configured)**Image selection priority for discussions:**

1. First `` found in the first post's rendered HTML
2. Default OG Image configured in Admin → Extensions → OG Image

---

Requirements
------------

[](#requirements)

DependencyVersionPHP≥ 8.1Flarum^2.0---

Installation
------------

[](#installation)

```
composer require ernestdefoe/og-image
php flarum cache:clear
```

---

Configuration
-------------

[](#configuration)

1. Go to **Admin → Extensions → OG Image**
2. Set **Default OG Image URL** — an absolute URL to an image used when a discussion has no embedded images (e.g. your forum banner)
    - Facebook recommends **1200 × 630 px** minimum
    - Must be publicly accessible (no auth required)
3. Set **Facebook App ID** (optional but recommended) — removes the "missing fb:app\_id" warning in the Facebook Sharing Debugger
    - Find your App ID at **developers.facebook.com → My Apps → your app → top-left of dashboard**
4. Click **Save Changes**

---

How it works
------------

[](#how-it-works)

The extension hooks into Flarum's server-side document rendering. Before the HTML is sent to the browser, it:

1. Checks the request route — discussions are detected via Flarum's `routeName` attribute or by matching `/d/{id}` in the URL path
2. Loads the discussion and its first post from the database
3. Renders the first post to HTML, strips tags for the description excerpt, and scans for the first `` to use as the OG image
4. Writes `` and `` tags into the ``

Because the tags are server-rendered, Facebook's scraper sees them immediately — no JavaScript execution required.

---

Using with the Facebook Auto-Post extension
-------------------------------------------

[](#using-with-the-facebook-auto-post-extension)

Install both extensions. When the Facebook Auto-Post extension posts a discussion URL to your Facebook Page, Facebook scrapes that URL and reads the OG tags this extension provides, producing a rich preview card with the discussion title, excerpt, and image.

---

Troubleshooting
---------------

[](#troubleshooting)

SymptomLikely causeNo preview on FacebookFacebook cached the page before OG tags were present — use the Sharing Debugger to force a re-scrapePreview shows no imageDiscussion has no `` in the first post and no default image is configuredDefault image not showingURL is not absolute, not publicly accessible, or returns a non-image content typeWrong descriptionThe excerpt is taken from the first post only; BBcode/markdown is stripped"Invalid App ID" warningYou entered your Facebook Page ID instead of your App ID — they are different numbersImage not showing on auto-posted Facebook postsSee **HTTP 206 response** section below---

HTTP 206 response — images not showing on Facebook posts
--------------------------------------------------------

[](#http-206-response--images-not-showing-on-facebook-posts)

The Facebook Sharing Debugger reports a **Response Code** for every URL it scrapes. If yours shows **206** instead of **200**, your web server is returning partial content to Facebook's crawler. This means Facebook may not receive the full `` section where OG tags live, causing the image (and other tags) to be missing from link previews.

**This is a web server configuration issue, not a Flarum or extension issue.**

### Nginx

[](#nginx)

Add to your server block:

```
proxy_force_ranges off;
```

### Apache

[](#apache)

Add to your `.htaccess` or virtual host config:

```
BrowserMatch "facebookexternalhit" no-gzip
```

### Cloudflare

[](#cloudflare)

If your site is proxied through Cloudflare, their edge cache may be serving partial responses. Add a Cache Rule to bypass caching for discussion pages:

1. Cloudflare dashboard → **Rules → Cache Rules**
2. Create a rule matching `fbsfb.com/d/*`
3. Set **Cache Status: Bypass**

After making any of these changes, go to **developers.facebook.com/tools/debug**, paste your discussion URL, and click **Scrape Again**. Confirm the Response Code changes to **200** before testing image previews.

---

Support
-------

[](#support)

Questions, bug reports, and feature requests:

- **Support forum:**
- **Issues:**

License
-------

[](#license)

MIT © Ernestdefoe

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance98

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

8

Last Release

10d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c9978664264055711c21fbcf73c937f758df771d9cb40f6a25370b10123e7abc?d=identicon)[ernestdefoe](/maintainers/ernestdefoe)

---

Top Contributors

[![ernestdefoe](https://avatars.githubusercontent.com/u/24905286?v=4)](https://github.com/ernestdefoe "ernestdefoe (18 commits)")

### Embed Badge

![Health badge](/badges/ernestdefoe-og-image/health.svg)

```
[![Health](https://phpackages.com/badges/ernestdefoe-og-image/health.svg)](https://phpackages.com/packages/ernestdefoe-og-image)
```

###  Alternatives

[flarum-lang/russian

Russian language pack for Flarum.

12127.5k](/packages/flarum-lang-russian)[fof/byobu

Well integrated, advanced private discussions.

61112.4k10](/packages/fof-byobu)[flarum/tags

Organize discussions into a hierarchy of tags and categories.

38744.9k133](/packages/flarum-tags)[fof/gamification

Upvotes and downvotes for your Flarum community

4162.0k6](/packages/fof-gamification)[fof/polls

 A Flarum extension that adds polls to your discussions

25130.2k9](/packages/fof-polls)[michaelbelgium/flarum-discussion-views

Add views to flarum discussions

3155.4k6](/packages/michaelbelgium-flarum-discussion-views)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
