# Shopify

## Getting Started

## Create a connection

1. Sign in to [OpenGraph+](/)
2. Go to your website's **Meta Tags** page
3. Create a new connection and copy your connection URL

Your connection URL looks like `https://$OGPLUS_KEY.ogplus.net`.

## Find your theme layout

In your Shopify admin, go to **Online Store → Themes → Edit code**. Open `layout/theme.liquid`.

## Add Open Graph meta tags

Add the following inside the `<head>` tag in `theme.liquid`:

```liquid
<head>
  <!-- ... other tags ... -->
  <meta property="og:title" content="{{ page_title }}">
  <meta property="og:description" content="{{ page_description | default: shop.description }}">
  <meta property="og:url" content="{{ canonical_url }}">
  <meta property="og:site_name" content="{{ shop.name }}">
  <meta property="og:type" content="{% if template contains 'product' %}product{% elsif template contains 'article' %}article{% else %}website{% endif %}">
  <meta property="og:image" content="https://$OGPLUS_KEY.ogplus.net{{ request.path }}">
  <meta name="twitter:card" content="summary_large_image">
</head>
```

Replace `https://$OGPLUS_KEY.ogplus.net` with your actual connection URL.

### Tag reference

| Tag | Value | Source |
|-----|-------|--------|
| `og:title` | Current page, product, or collection title | `page_title` |
| `og:description` | Page SEO description, falls back to store description | `page_description` / `shop.description` |
| `og:url` | Full canonical URL of the current page | `canonical_url` |
| `og:site_name` | Your store name | `shop.name` |
| `og:type` | `product`, `article`, or `website` based on page type | `template` |
| `og:image` | Dynamic social card image from OpenGraph+ | Connection URL + page path |
| `twitter:card` | Always `summary_large_image` for large preview cards | Static value |

## What each variable does

- **`page_title`** - Shopify sets this automatically for each page, product, collection, and blog post
- **`page_description`** - the SEO description set in each page/product's SEO settings
- **`shop.description`** - your store description from Settings → General (used as fallback)
- **`canonical_url`** - the full URL of the current page, set by Shopify
- **`shop.name`** - your store name from Settings → General
- **`template`** - identifies the current page type (`product`, `article`, `collection`, `page`, etc.)
- **`request.path`** - the current page path, used to build the og:image URL

## Remove existing og:image tags

Shopify themes typically include `og:image` tags already. Search your theme files for existing `og:image` meta tags and remove or comment them out to avoid duplicates. Common locations:

- `snippets/social-meta-tags.liquid`
- `snippets/meta-tags.liquid`

## Verify

Open the preview tool in your OpenGraph+ dashboard and paste a URL from your store. View your page source and confirm all Open Graph meta tags are present with correct values.


## Customize

OpenGraph+ captures your page in a headless browser and renders it as an image. You control what gets captured using meta tags in your theme and CSS in your stylesheets.

All of the rendering options below are standard HTML meta tags and CSS, so they work the same regardless of framework. The [HTML, CSS, & HTTP guide](/docs/html-css) covers each one in detail. This page shows how to wire them into a Shopify store.

## Meta tags

Add these to `layout/theme.liquid` inside the `<head>` tag alongside your `og:image` tag. They're all optional.

```liquid
<head>
  <meta property="og:image" content="https://$OGPLUS_KEY.ogplus.net{{ request.path }}">
  <meta name="twitter:card" content="summary_large_image">

  <!-- Render at 800px wide instead of the default -->
  <meta property="og:plus:viewport:width" content="800">

  <!-- Only capture this element instead of the full page -->
  <meta property="og:plus:selector" content=".product-single">

  <!-- Inject inline styles on the captured element -->
  <meta property="og:plus:style" content="padding: 60px; background: #0f172a; color: white;">
</head>
```

See the [Rendering](/docs/html-css/rendering) guide for what each meta tag does and how they interact.

## CSS styling

OpenGraph+ adds a `data-ogplus` attribute to your `<html>` element during capture. Use it in your stylesheets to hide navigation, adjust spacing, or restyle anything for the social card without affecting your actual site.

In your Shopify admin, go to **Online Store > Themes > Edit code** and add the following to your theme's CSS file in the `assets/` folder:

```css
html[data-ogplus] {
  .header { display: none; }
  .footer { display: none; }
  .announcement-bar { display: none; }
  .product-single { padding: 60px; }
}
```

If you're using Tailwind, there's a plugin that gives you `ogplus:` variants like `ogplus:hidden` and `ogplus-twitter:bg-sky-500`. See [CSS Styling](/docs/html-css/data-attributes) for plain CSS examples and [Tailwind setup](/docs/html-css/data-attributes#tailwind-css).

## Templates

For fully custom social card layouts that pull content from your page, use `<template>` elements. These let you build a completely different layout for screenshots without touching your visible page.

Add this to `layout/theme.liquid`:

```liquid
<template id="ogplus">
  <div style="padding: 48px; background: #0f172a; color: white; height: 100%;">
    <h1 style="font-size: 48px;">
      ${document.querySelector('h1')?.textContent}
    </h1>
  </div>
</template>
```

See the [Templates](/docs/html-css/templates) guide for expression syntax, platform-specific templates, and full examples.

## Testing locally

The [Preview Bookmarklet](/docs/html-css/bookmarklet) sets the `data-ogplus` attribute in your browser so you can see how your CSS and Tailwind variants look without deploying or waiting for a real crawler to hit your page.

## Full example

A theme layout with all the pieces together:

```liquid
<head>
  <meta property="og:title" content="{{ page_title }}">
  <meta property="og:description" content="{{ page_description | default: shop.description }}">
  <meta property="og:image" content="https://$OGPLUS_KEY.ogplus.net{{ request.path }}">
  <meta name="twitter:card" content="summary_large_image">
  <meta property="og:plus:selector" content=".product-single">
  <meta property="og:plus:style" content="padding: 60px; background-color: #0f172a; color: white;">
  <meta property="og:plus:viewport:width" content="800">
</head>
```


## Troubleshooting

Something not working? Here are the most common issues and how to fix them.

## Meta tags not appearing

Make sure you added the tags to `layout/theme.liquid`, not just a section or template. `theme.liquid` is the master layout that wraps every page.

**Check:** View your page source, not DevTools. Page source shows what crawlers see.

## Duplicate og:image tags

Shopify themes include social meta tags by default. Search your theme files for `og:image` — especially `snippets/social-meta-tags.liquid` and `snippets/meta-tags.liquid` — and remove or comment out the existing tags.

## Wrong image showing

This is almost always a caching issue. Shopify's CDN caches pages.

1. Wait a few minutes after making theme changes
2. Open the preview tool in your OpenGraph+ dashboard
3. If the image is still stale, purge it from the dashboard
4. Re-check with the preview tool

## Liquid syntax

`{{ request.path }}` is a Shopify Liquid object. Don't wrap it in quotes or escape it. If the output looks wrong, check that you're using `request.path` (not `request.url` which includes the full domain).

The meta tag should look like this in your template:

```liquid
<meta property="og:image" content="https://$OGPLUS_KEY.ogplus.net{{ request.path }}">
```

## Social platforms not updating

Twitter, LinkedIn, and Slack cache images aggressively on their end. After confirming the correct image appears in the OpenGraph+ preview tool:

- **Twitter:** Use the [Card Validator](https://cards-dev.twitter.com/validator) to force a refresh
- **LinkedIn:** Use the [Post Inspector](https://www.linkedin.com/post-inspector/) to clear their cache
- **Facebook:** Use the [Sharing Debugger](https://developers.facebook.com/tools/debug/) to scrape again

This is platform-side caching that OpenGraph+ cannot control.

## Purging cached images

1. Go to your website dashboard in OpenGraph+
2. Find the page you want to refresh
3. Click purge to clear the cached image

The next request from a social platform will trigger a fresh render.

## Testing

Use the preview tool in your OpenGraph+ dashboard to verify your setup before sharing URLs. This shows you exactly what social platforms will see.

