=== Upbinger Blog ===
Contributors: upbinger
Tags: blog, embed, seo, shadow-dom, content
Requires at least: 5.6
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 2.0.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Embed your Upbinger-hosted blog directly into any WordPress page with full CSS isolation, SEO meta injection, and anonymous visit analytics.

== Description ==

**Upbinger Blog** lets you seamlessly embed your blog content — published through [Upbinger](https://upbinger.com) — into your WordPress site. The plugin uses **Shadow DOM** for complete CSS isolation, so your blog styles never clash with your theme.

= Key Features =

* **Customizable Styles** — Configure grid title, colors, fonts, spacing, and more from the Upbinger dashboard (Publish → Style tab). Changes apply on next publish.\n* **Back to Blog Navigation** — Configurable "← Back to Blog" link on every post for easy grid return.\n* **Shadow DOM Isolation** — Blog CSS lives inside a shadow root and cannot interfere with your theme or vice versa.
* **rem → em Conversion** — Automatically converts CSS `rem` units to `em` so blog typography renders correctly regardless of your theme's root font-size.
* **SEO Meta Injection** — Open Graph, Twitter Card, canonical link, and JSON-LD structured data are injected into the page `<head>` for search engines and social media.
* **SPA Navigation** — Internal blog links navigate without a full page reload. Back/forward buttons work as expected.
* **Google Fonts in Light DOM** — Font stylesheets are hoisted into the page `<head>` so they load correctly across all browsers.
* **Anonymous Analytics** — Visit counts are sent via `sendBeacon` with session deduplication. No cookies, no PII.
* **Automatic Container Detection** — Finds the best content area in your theme automatically, or you can specify a CSS selector.

= How It Works =

1. Your blog HTML is published to the Upbinger CDN.
2. The plugin fetches the correct page from the CDN when a visitor loads your blog route.
3. The HTML is cleaned, adapted for Shadow DOM (CSS scoping, rem→em, SEO extraction), and injected into an isolated shadow root.
4. Visitors see your blog styled exactly as designed, with zero CSS side-effects.

= Requirements =

* An active [Upbinger](https://upbinger.com) account with a published blog.
* WordPress 5.0 or higher.
* PHP 7.4 or higher.

== Installation ==

1. Upload the `upbinger-blog` folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Navigate to **Settings → Upbinger Blog**.
4. Enter your site domain (e.g. `example.com`) and blog base path (e.g. `/blog`).
5. Optionally specify a CSS container selector or enable debug logging.
6. Visit your blog page to verify content loads correctly.

== Frequently Asked Questions ==

= Do I need an Upbinger account? =

Yes. The plugin loads blog content from Upbinger's CDN, so you need a published blog on the platform.

= Will this break my theme's styles? =

No. All blog CSS is isolated inside a Shadow DOM root. Your theme's CSS cannot leak in, and the blog's CSS cannot leak out.

= Why are font sizes different on my site? =

Some themes set `html { font-size: 62.5%; }` which changes the meaning of CSS `rem` units. This plugin automatically converts `rem` to `em` and sets a 16px base so blog text renders at the intended size.

= Does this affect my SEO? =

Positively. The plugin injects Open Graph, Twitter Card, canonical link, and JSON-LD structured data into the page `<head>` so search engines and social platforms can properly index and preview your blog content.

= Are analytics GDPR compliant? =

Yes. The plugin sends anonymous page-view events only (no cookies, no personal data). You can also disable analytics entirely from the settings page.

== Screenshots ==

1. Settings page with domain, base path, and container configuration.

== Changelog ==

= 2.0.2 =
* Fix: Remove ALL duplicate canonical tags (not just first one) to prevent SEO conflicts.
* Fix: Strip .html suffix from canonical and og:url for clean public-facing URLs.
* Fix: Deduplicate meta tags by property/name before injecting.
* Add: Light DOM H1 tag for SEO crawlers that cannot read Shadow DOM content.

= 2.0.1 =
* Fix duplicate JSON-LD structured data (BlogPosting + FAQPage) appearing in both document head and Shadow DOM.

= 2.0.0 =
* Complete rewrite for WordPress.org coding standards.
* Shadow DOM isolation for CSS conflict prevention.
* rem → em conversion for theme compatibility.
* SEO meta injection (OG, Twitter, canonical, JSON-LD).
* SPA-style internal navigation.
* Anonymous analytics with session deduplication.
* Debug logging gated behind an admin setting.
* Proper escaping, sanitization, and i18n throughout.

= 1.0.0 =
* Initial release.

== External services ==

This plugin relies on two third-party services provided by Upbinger.

= Upbinger CDN (cdn.upbinger.com) =

Blog HTML, CSS, images, and font references are fetched from the Upbinger content-delivery network every time a visitor loads a blog page on your site.

* **What is sent:** an HTTPS GET request containing only the URL path of the blog page being loaded (e.g. `/blogs/example.com/index.html`). No cookies or personal data are transmitted.
* **When:** on every front-end page load of the blog route.
* **Service provider:** Upbinger — [Terms of Service](https://upbinger.com/terms) | [Privacy Policy](https://upbinger.com/privacy)

= Upbinger Analytics API =

Anonymous page-view events are sent so site owners can see which posts are popular. No cookies are set and no personally-identifiable information is collected.

* **What is sent:** the page path, a session-scoped deduplication flag (stored in `sessionStorage`), and the site domain. The request is made via `navigator.sendBeacon`.
* **When:** once per unique page view per browser session (deduplicated). Can be disabled entirely from **Settings → Upbinger Blog → Disable Analytics**.
* **Endpoint:** `https://m745tnh6jg.execute-api.us-east-1.amazonaws.com/api/trackVisit`
* **Service provider:** Upbinger — [Terms of Service](https://upbinger.com/terms) | [Privacy Policy](https://upbinger.com/privacy)

== Upgrade Notice ==

= 2.0.0 =
Major rewrite with full Shadow DOM isolation, SEO enhancements, and WordPress.org coding standards compliance. Recommended for all users.
