Social Feeds docs
Social Feeds shows a business's own Instagram posts on its website. This page lists everything you can set and style. For worked examples, see overriding the design. Coding agents can read the same reference as plain text.
Contents
- Installing
- How a feed's look is decided
- Settings
- Named looks
- The Astro component
- Tokens
- Classes
- Data attributes
- The embed for any website
- The JSON API
- Your own markup
- The site key
- Plan limits
Installing
EmDash
In the site's folder, run:
npx @ninetysixsoftware/social-feeds init
It installs the package and adds socialFeeds() to the EmDash plugins in astro.config.mjs. Running it again
changes nothing. --dry-run shows what it would change, --feed <id> shows that feed until the site is linked, and
--claude copies a Claude Code skill for placing the feed into .claude/skills/. If it can't edit the config
safely, it leaves it alone and prints what to add:
// astro.config.mjs
import socialFeeds from "@ninetysixsoftware/social-feeds";
emdash({
// ...
plugins: [socialFeeds()],
});
Then open the site's admin, go to Plugins, then Social Feeds, start a free trial or link your account, and connect Instagram. Editors get an Instagram feed block in the page editor. Developers can put the component in a template.
The admin page keeps the site key encrypted, which needs EmDash's EMDASH_ENCRYPTION_KEY. Sites made with
create-emdash have one. Nothing needs adding to wrangler.jsonc.
Astro without EmDash
Install @ninetysixsoftware/social-feeds and use the component. Start your trial and connect Instagram in your
Social Feeds account.
Any other website
Add the site's address in your Social Feeds account, connect Instagram, and paste the embed code where the posts should go:
<div data-social-feed="your-feed-id"></div>
<script src="https://feeds.ninetysixsoftware.co.uk/embed.js" async></script>
With Claude Code
Paste this into Claude Code in the site's folder, with your feed id:
Run `npx @ninetysixsoftware/social-feeds init --claude` in this site. Then read .claude/skills/social-feed/SKILL.md and follow it to place my Instagram feed where it fits this site's design. Docs: https://feeds.ninetysixsoftware.co.uk/llms.txt
How a feed's look is decided
Four layers, each overriding the one before, so the result is always predictable:
- Settings in the Social Feeds admin page or your account. They come with the feed, so a change shows without a deploy, within about 5 minutes.
- Props on the component, or data attributes on the embed, for one placement.
- Tokens, the
--nsf-*custom properties, set in your CSS. - Your CSS on the classes and data attributes.
The feed's styles sit in a cascade layer called nsf, behind :where(), so any normal CSS on your site wins.
You never need !important. A few spacing resets for lists, margins and images sit outside the layer, so a page's text
styles don't leak into the feed. They're plain two-class selectors, easy to override.
Settings
Every setting with its default. These are the names in the JSON API. Props and embed attributes take the same values. Each feed has a default look and up to 5 named looks, each a full set of these.
Layout
| Setting | Default | Values | What it does |
|---|---|---|---|
layout | "strip" | strip, grid, carousel, masonry | strip is one row that scrolls sideways, with columns posts across. carousel shows one post at a time, centred and up to --nsf-carousel-width wide, and ignores columns. grid wraps into rows. masonry is columns of images at their own heights. |
posts | null | 1 up to the plan's posts per feed, or null | How many posts to show. null shows every post the plan allows. Only trims what's shown, it never fetches more. With show_more, the size of each batch. |
show_more | false | true, false | Grid and masonry only. A Show more button adds another batch of posts, up to the plan's posts per feed. |
Size
| Setting | Default | Values | What it does |
|---|---|---|---|
columns | {"phone":2.4,"tablet":4,"desktop":6} | phone 1 to 4, tablet 1 to 8, desktop 1 to 10, to one decimal place | Tiles across. Tablet starts at 640px wide and desktop at 1024px. In a strip, a fraction like 2.4 shows part of the next tile, so people can see it scrolls. Grid and masonry round down to whole tiles. |
gap | 12 | 0 to 48 (pixels) | The space between tiles. |
radius | 8 | 0 to 48 (pixels) | Corner radius of the tiles. Buttons and the arrows below the posts use half of it. |
shape | "square" | square, portrait, landscape, original | square is 1:1, portrait 4:5, landscape 4:3, and original keeps each image's own shape. Masonry always uses original. |
fit | "cover" | cover, contain | cover crops each image to fill its tile. contain fits the whole image inside, so posters and graphics keep their edges. |
border | false | true, false | A border round each tile, border_width wide, in border_color. |
tile_size | {"phone":null,"tablet":null,"desktop":null} | { phone, tablet, desktop }, each 60 to 800 or null | A post's width in pixels on that device, instead of columns. A strip uses it for each post, a grid fits as many as there's room for, masonry makes columns that wide, and a carousel's post is that wide. null uses columns. |
border_width | 1 | 1 to 8 | The border's width in pixels, when border is on. |
border_color | null | a colour like #d4a73a, or null | The border's colour. null is a soft line from the text colour (--nsf-border). |
Scrolling
| Setting | Default | Values | What it does |
|---|---|---|---|
snap | "start" | none, start, center | Where a strip or carousel comes to rest after scrolling. none lets it stop anywhere. |
arrows | "hover" | always, hover, never | Arrows for a strip or carousel. hover shows them when the pointer is over the feed, and hides the side arrows on touch screens, which swipe instead. |
edge | {"phone":false,"tablet":false,"desktop":false} | phone, tablet and desktop, each true or false | A strip or carousel runs out to the screen's edges on that device, while its first tile still lines up with the page. Needs the feed's script, which measures the gap to the edge. An ancestor with overflow hidden clips it. |
arrows_position | "sides" | sides, below | sides puts round buttons over the posts. below puts square buttons under them, greyed out at each end. |
scroll_by | "page" | page, tile | What the arrows and autoplay move by: a page of tiles, or one tile. |
fade | false | true, false | Fades the edges of a strip or carousel where there's more to scroll to. |
drag | true | true, false | Lets people drag a strip or carousel sideways with a mouse. Touch always scrolls. |
autoplay | 0 | 0, or 2 to 15 (seconds) | Seconds between automatic moves in a strip or carousel. 0 is off. It pauses on hover and focus, and never runs for people who ask for reduced motion. |
Content
| Setting | Default | Values | What it does |
|---|---|---|---|
captions | "off" | off, below, hover | Captions without hashtags, under each tile or over it on hover. Touch screens always show hover captions. |
caption_lines | 2 | 1 to 6 | Lines of caption before it's cut off. |
badges | true | true, false | Small video and carousel icons on tiles. |
Header and Follow link
| Setting | Default | Values | What it does |
|---|---|---|---|
header | "username" | none, username, profile, icon | username shows the heading (the title, or @username). profile shows the account's picture, name and @username. icon shows an Instagram icon with the heading and the intro line. none hides the header. |
title | null | up to 80 characters, or null | The heading instead of @username. null uses the username. |
subtitle | null | up to 160 characters, or null | An intro line under the heading. |
heading | "p" | p, h2, h3 | The heading's element. h2 and h3 take the site's own heading styles. p uses the feed's --nsf-title-font and --nsf-title-size. |
accent | null | a colour like #2cf08b, or null | The colour of button and arrow hovers, focus rings, and the Instagram icon unless icon_color is set. null follows the text colour. |
font | "site" | site, sans, serif, mono, grotesque, humanist, geometric, classical, rounded, condensed, old_style, slab, didone, handwritten | The feed's text. site keeps the page's own font. The others are font stacks already on people's devices, so nothing extra loads, and each looks a little different on Mac, Windows and phones. A heading set to h2 or h3 keeps the site's heading font. |
text_color | null | a colour like #1d1e20, or null | The colour of the heading, captions and links. null follows the site. |
icon_style | "outline" | outline, solid, gradient | The Instagram icon in the icon header: an outline, filled in, or in Instagram's own gradient. |
icon_color | null | a colour like #e1306c, or null | The icon's colour. null uses accent. Not used for the gradient. |
follow | "header" | off, header, below | Where the link to the Instagram profile goes: off, in the header, or below the posts. |
follow_label | "Follow on Instagram" | 1 to 40 characters | The Follow link's text. |
follow_style | "link" | link, button, pill | A plain link, a button, or a pill (a fully rounded button). |
follow_fill | "outline" | outline, filled | For a button or pill: outlined, or filled with the accent colour (the text colour if there's no accent), with black or white text to suit. |
header_position | "above" | above, below | The header above or below the posts. A Follow link in the header moves with it. |
header_align | "spread" | spread, start, center, end | spread puts the heading at the start and the Follow link at the end. start, center and end keep them together there. |
footer_align | "center" | start, center, end | Where Show more and a Follow link below the posts sit. |
title_size | null | 10 to 72, or null | The heading's or name's size in pixels. null uses the feed's own, or the site's heading style. |
title_weight | null | 300, 400, 500, 600, 700, 800, 900, or null | The heading's or name's weight. null uses the feed's own, or the site's heading style. |
follow_size | null | 10 to 32, or null | The Follow link's text size in pixels. null matches the feed. |
follow_weight | null | 300, 400, 500, 600, 700, 800, 900, or null | The Follow link's weight. null uses the feed's own. |
icon_size | 44 | 29 to 96 | The Instagram icon's and profile picture's size in pixels. 29 is the smallest Instagram allows for its icon. |
Motion and clicks
| Setting | Default | Values | What it does |
|---|---|---|---|
hover | "zoom" | none, zoom, darken, lift | What a tile does under the pointer: nothing, zoom the image, darken it, or lift the tile and zoom. |
fade_in | true | true, false | Images fade in as they load. |
click | "instagram" | instagram, lightbox, none | instagram opens the post on Instagram. lightbox shows it larger on the page with its caption. none means tiles aren't links. Plan lightbox needs Pro or Agency. On other plans it falls back to "instagram". |
Stored
| Setting | Default | Values | What it does |
|---|---|---|---|
version | 4 | 4 | The schema version. Older stored settings are upgraded when read, and every new setting's default keeps an older feed looking as it did. |
hidden | [] | a list of post ids | Posts the site has hidden in the admin. They're never sent in the public feed and don't count towards the plan's posts per feed. |
Named looks
A look is another set of settings for the same feed, so one feed can be a strip on the home page and a grid on another page. A feed has its default look and up to 5 named looks. Make them in the Social Feeds admin page or your account.
- A look's id comes from its name: "Gallery grid" is
gallery-grid. -
Use one by id or name, ignoring case:
<SocialFeed feed="..." look="Gallery grid" />,data-look="gallery-grid"on the embed, the editor block's Look field, or?look=on the API. - An unknown look shows the default look, so a renamed look never breaks a page.
- Hidden posts belong to the feed, so every look hides the same posts.
The Astro component
---
import SocialFeed from "@ninetysixsoftware/social-feeds/SocialFeed.astro";
---
<!-- EmDash: shows the feed linked in the Social Feeds admin page -->
<SocialFeed />
<SocialFeed look="Homepage" class="site-feed" />
<SocialFeed layout="grid" posts={6} columns={{ phone: 2, desktop: 3 }} title={false} />
<!-- Astro without EmDash, or a site with several feeds -->
<SocialFeed feed="your-feed-id" />
It renders on the server, so the tiles are in the page's HTML. It adds the stylesheet once per page, however many feeds it has.
Props
| Prop | Type | What it does |
|---|---|---|
feed | string | The feed id from Social Feeds. Not a secret. On an EmDash site, leave it out to show the feed linked in the Social Feeds admin page. Required on other Astro sites. |
look | string | A named look, by id or name. Blank uses the default look. |
class | string | Extra classes on the feed's section, for your CSS. |
any setting | as in the settings | Overrides that setting for this placement. Use the setting's name or camelCase: captionLines, scrollBy, arrowsPosition, fadeIn, showMore, followStyle, followLabel. |
columns | { phone, tablet, desktop } | Tiles across. Give any of the three. |
title | string or false | The heading text. false hides the whole header. |
follow | string or false | The Follow link's label. false hides the link. |
followPosition | "header" or "below" | Where the Follow link goes. |
siteKey | string | The feed's site key. Defaults to the SOCIAL_FEEDS_KEY_<FEED_ID> or SOCIAL_FEEDS_KEY secret, which is better than a prop. |
cacheSeconds | number | How long the site's server reuses the feed. Default 60. 0 turns it off. |
nonce | string | Your Content Security Policy's nonce, put on the feed's style elements, so style-src needs no 'unsafe-inline'. |
apiOrigin | string | Another copy of the service, for testing. SOCIAL_FEEDS_API does the same for every feed. |
Slots
| Slot | What it does |
|---|---|
header | Replaces what's inside the header: the heading, the profile and the Follow link. |
footer | Added below the posts, after Show more and the Follow link. |
empty | Shown when there are no posts, or Social Feeds doesn't answer within 2 seconds. Without it, nothing is shown. |
<SocialFeed feed="your-feed-id" heading="h2">
<h2 slot="header" class="section-title">On Instagram</h2>
<p slot="empty">See our latest posts on Instagram.</p>
</SocialFeed>
Caching
The component keeps each feed for 60 seconds on the server that renders the page: in Cloudflare's cache on Workers, otherwise
in memory. If Social Feeds is slow or down, the last good copy shows for up to a day. On a page that's prerendered at build
time, the feed only changes when the site is rebuilt, so use export const prerender = false on pages with a feed.
Tokens
Set these in your own CSS on the feed, or on the class you gave it:
.site-feed {
--nsf-radius: 0;
--nsf-gap: 16px;
--nsf-columns-desktop: 4;
}
| Token | Default | What it sets |
|---|---|---|
--nsf-columns | var(--nsf-columns-phone, 2.4) | Tiles across at the current width. Set it to fix the number at every width. |
--nsf-columns-phone | 2.4 (setting) | Tiles across below 640px. From the columns setting. |
--nsf-columns-tablet | 4 (setting) | Tiles across from 640px. From the columns setting. |
--nsf-columns-desktop | 6 (setting) | Tiles across from 1024px. From the columns setting. |
--nsf-gap | 12px | Space between tiles. From the gap setting. |
--nsf-radius | 8px | Tile corners. From the radius setting. |
--nsf-aspect | 1 | Tile shape, from the shape setting: 1, 4 / 5, 4 / 3 or auto. |
--nsf-tile-bg | color-mix(in srgb, currentColor 8%, transparent) | Shows behind each image while it loads. |
--nsf-title-font | inherit | The heading's font, when the heading is a p. |
--nsf-title-size | 1.25rem | The heading's size. title_size sets it, and then it beats the site's heading style too. |
--nsf-avatar-size | 44px | The profile picture and Instagram icon in the header. |
--nsf-muted | color-mix(in srgb, currentColor 62%, transparent) | The intro line and @username. |
--nsf-button-radius | 999px | The corners of a pill Follow button. |
--nsf-button-border | color-mix(in srgb, currentColor 28%, transparent) | The outline of buttons and the arrows below the posts. |
--nsf-button-bg | A filled Follow button's colour. From the accent setting, otherwise the text colour. | |
--nsf-button-fg | A filled Follow button's text: black or white, whichever reads on --nsf-button-bg. | |
--nsf-edge-start | With the edge setting, the gap from the feed's left to the screen's edge. The feed's script measures it, and you can set it yourself. | |
--nsf-edge-end | The same on the right. | |
--nsf-caption-font | inherit | Caption font. |
--nsf-caption-size | 0.875rem | Caption size. |
--nsf-caption-lines | 2 | Lines before a caption is cut off. From the caption_lines setting. |
--nsf-caption-overlay | rgb(0 0 0 / 0.62) | Behind captions shown on hover. |
--nsf-darken | rgb(0 0 0 / 0.28) | The darken hover's colour. |
--nsf-arrow-bg | Canvas | Round arrows' background. Canvas follows the page's colour scheme. |
--nsf-arrow-fg | CanvasText | Round arrows' icon colour. |
--nsf-arrow-size | 44px | Arrow button size. |
--nsf-fade-size | 48px | How far the edge fade reaches. |
--nsf-carousel-width | 640px | The widest a carousel's post gets. On wider screens the posts either side peek in. |
--nsf-accent | currentColor | Hovers, focus rings, and the Instagram icon unless --nsf-icon is set. From the accent setting. |
--nsf-icon | The Instagram icon's colour. From the icon_color setting, otherwise --nsf-accent. | |
--nsf-text | The feed's text colour. From the text_color setting, otherwise the site's. | |
--nsf-font | The feed's font. From the font setting, otherwise the site's. | |
--nsf-focus | var(--nsf-accent) | Focus rings. Follows --nsf-accent. |
--nsf-border | color-mix(in srgb, currentColor 16%, transparent) | Tile borders, when the border setting is on. border_color sets it. |
--nsf-border-width | The tile border's width. border_width sets it. | |
--nsf-follow-size | The Follow link's text size, when follow_size is set. | |
--nsf-follow-weight | The Follow link's weight, when follow_weight is set. | |
--nsf-title-weight | The heading's weight, when title_weight is set. | |
--nsf-control-radius | calc(var(--nsf-radius) / 2) | Corners of outlined buttons and the arrows below the posts. Half of --nsf-radius. |
--nsf-badge | #fff | Video and carousel icons. |
--nsf-hover-zoom | 1.04 | How far the zoom hover scales the image. 1 turns it off. |
--nsf-lightbox-backdrop | rgb(0 0 0 / 0.82) | Behind the lightbox. |
--nsf-lightbox-bg | Canvas | The lightbox panel. Unless you set it, it takes the page's background. |
--nsf-lightbox-fg | CanvasText | The lightbox text. Unless you set it, it takes the feed's text colour. |
Classes
Class names are prefixed and only change in a major version.
| Class | What it is |
|---|---|
.nsf-feed | The whole feed, a section. Carries the data attributes below. |
.nsf-feed__header | The header row: the heading or profile, and the Follow link. data-header says which. |
.nsf-feed__intro | The heading and intro line, with header username. |
.nsf-feed__title | The heading, with header username. |
.nsf-feed__subtitle | The intro line. |
.nsf-feed__profile | The picture or icon and the names, with header profile or icon. |
.nsf-feed__avatar | The profile picture, or its first letter. |
.nsf-feed__icon | The Instagram icon, with header icon. |
.nsf-feed__names | The name and the line under it. |
.nsf-feed__name | The heading, with header profile or icon. |
.nsf-feed__username | The @username under the name. |
.nsf-feed__follow | The Follow link. data-style is link, button or pill. |
.nsf-feed__viewport | Holds the posts and the side arrows. |
.nsf-feed__track | The list of posts. It scrolls in a strip or carousel. |
.nsf-feed__item | One post. data-type is image, video or carousel. |
.nsf-feed__link | The post's link, or a div when click is none. |
.nsf-feed__media | The image's frame, which clips the corners. |
.nsf-feed__img | The image. |
.nsf-feed__badge | The video or carousel icon. |
.nsf-feed__caption | The caption. |
.nsf-feed__nav | An arrow button. |
.nsf-feed__nav--prev | The previous arrow. |
.nsf-feed__nav--next | The next arrow. |
.nsf-feed__controls | The row of arrows below the posts. |
.nsf-feed__footer | Below the posts: Show more and the Follow link. |
.nsf-feed__more | The Show more button. |
.nsf-lightbox | The lightbox, a dialog inside the feed. |
.nsf-lightbox__frame | The lightbox's two columns. |
.nsf-lightbox__media | The lightbox image's frame. |
.nsf-lightbox__img | The lightbox image. |
.nsf-lightbox__panel | The caption side of the lightbox. |
.nsf-lightbox__title | The lightbox heading. |
.nsf-lightbox__caption | The full caption. |
.nsf-lightbox__date | The post's date. |
.nsf-lightbox__open | The link to the post on Instagram. |
.nsf-lightbox__close | The close button. |
.nsf-lightbox__nav | The lightbox's arrows. |
.nsf-lightbox__nav--prev | The lightbox's previous arrow. |
.nsf-lightbox__nav--next | The lightbox's next arrow. |
Data attributes
Settings and state show as data attributes, not extra classes, so you can style them:
.site-feed[data-layout="grid"] .nsf-feed__item[data-type="video"] { outline: 2px solid red; }
| Attribute | On | What it says |
|---|---|---|
data-layout | .nsf-feed | The layout setting. |
data-shape | .nsf-feed | The shape setting. |
data-snap | .nsf-feed | The snap setting. |
data-arrows | .nsf-feed | The arrows setting. |
data-arrows-position | .nsf-feed | sides or below, when there are arrows. |
data-captions | .nsf-feed | The captions setting. |
data-hover | .nsf-feed | The hover setting. |
data-fit | .nsf-feed | The fit setting. |
data-border | .nsf-feed | Present when tiles have borders. |
data-click | .nsf-feed | The click setting. |
data-scroll-by | .nsf-feed | page or tile, in a strip or carousel. |
data-fade | .nsf-feed | Present when a strip or carousel fades at its edges. |
data-edge | .nsf-feed | The devices a strip or carousel runs to the screen's edges on: phone, tablet and desktop, space separated. |
data-device | .nsf-feed | Only in the admin previews: the device they show, so the edge follows it. |
data-header-align | .nsf-feed | start, center or end, when the header isn't spread. |
data-header-position | .nsf-feed | below, when the header is under the posts. |
data-footer-align | .nsf-feed | start or end, when the footer isn't centred. |
data-title-size, data-title-weight | .nsf-feed | Present when the heading's size or weight is set, which then beats the site's heading style. |
data-follow-size, data-follow-weight | .nsf-feed | Present when the Follow link's size or weight is set. |
data-fill-ready | .nsf-feed | Present once a filled Follow button's colour is known, from the settings or the site's text colour. |
data-fill | .nsf-feed__follow | filled for a filled button or pill. |
data-drag | .nsf-feed | Present when a strip or carousel can be dragged with a mouse. |
data-autoplay | .nsf-feed | Seconds between moves, when autoplay is on. |
data-fade-in | .nsf-feed | Present when images fade in. |
data-batch | .nsf-feed | Posts per batch, when Show more is on. |
data-nsf-id | .nsf-feed | A unique id for this placement. The setting tokens are scoped to it. |
data-nsf-feed | .nsf-feed | The feed id. |
data-ready | .nsf-feed | Added once the script is running. |
data-at-start | .nsf-feed | Added while a strip is scrolled to the start. |
data-at-end | .nsf-feed | Added while a strip is scrolled to the end. |
data-dragging | .nsf-feed | Added while someone drags the strip. |
data-header | .nsf-feed__header | none, username, profile, icon, or custom for the header slot. |
data-type | .nsf-feed__item | image, video or carousel. |
data-style | .nsf-feed__follow | link, button or pill. |
data-caption | .nsf-feed__link | The caption, for the lightbox. |
data-time | .nsf-feed__link | The post's date, for the lightbox. |
data-loaded | .nsf-feed__img | Added when the image has loaded, for the fade in. |
The embed for any website
<div data-social-feed="your-feed-id"></div>
<script src="https://feeds.ninetysixsoftware.co.uk/embed.js" async></script>
It draws the feed with the same code and styles as the component, so the same tokens and classes work. The feed only loads on the site addresses in your Social Feeds account. Attributes on the div override settings for that placement:
| Attribute | What it does |
|---|---|
data-social-feed | Required. The feed id. |
data-look | A named look, by id or name. |
nonce (on the script tag) | Your Content Security Policy's nonce. The embed puts it on the feed's style elements too. |
data-layout, data-posts, data-gap and the rest | Any setting, with dashes: data-caption-lines, data-arrows-position, data-scroll-by, data-follow-style, data-show-more. |
data-columns-phone, data-columns-tablet, data-columns-desktop | Tiles across at each width. |
data-edge-phone, data-edge-tablet, data-edge-desktop | true or false. A strip runs to the screen's edges at that width. |
data-tile-size-phone, data-tile-size-tablet, data-tile-size-desktop | A post's width in pixels at that width, or auto to use columns. |
data-title | The heading. Empty hides the header. |
data-follow | off, header or below. Empty or false hides the link. Any other text is the link's label. |
<div data-social-feed="your-feed-id" data-look="gallery-grid" data-columns-desktop="3" data-follow-label="See more"></div>
The JSON API
GET https://feeds.ninetysixsoftware.co.uk/api/feeds/your-feed-id?limit=6&look=homepage
{
"feed": "your-feed-id",
"username": "harbourgym",
"name": "Harbour Gym",
"avatar_url": "https://...",
"profile_url": "https://www.instagram.com/harbourgym/",
"updated_at": "2026-11-24T09:15:00.000Z",
"settings": { "version": 3, "layout": "strip", "posts": 8, ... },
"looks": { "homepage": { "name": "Homepage", "settings": { ... } } },
"posts": [
{
"id": "17900000000000000",
"type": "image",
"image_url": "https://...",
"thumbnails": { "320": "https://...", "640": "https://..." },
"permalink": "https://www.instagram.com/p/.../",
"caption": "Leg day #gym",
"timestamp": "2026-11-23T18:02:11+0000"
}
]
}
limitis 1 to 50 and never more than the plan's posts per feed. Without it you get the look's number of posts.lookpicks a named look by id or name.settingsare then that look's.-
thumbnailsare the image resized to 320 and 640 pixels wide. They're null until the post has been resized, so useimage_urlmeanwhile. - A feed with nothing to show yet, or whose plan has ended, answers with no posts. An unknown feed is a 404.
- Answers are cached for up to 5 minutes. Browsers can only read it from the feed's own site addresses (CORS).
-
From a site's server, send the site key as
Authorization: Bearer nsk_...to be rate limited on your own, at 1,200 requests a minute instead of 120 per address. A key that isn't accepted addsx-site-key: not-acceptedto the answer and the feed still loads.
Your own markup
getFeed() gives you the posts and settings as data, with the thumbnails, caching and plan limits:
---
import { getFeed } from "@ninetysixsoftware/social-feeds";
const feed = await getFeed("your-feed-id");
---
{feed && (
<ul class="my-posts">
{feed.posts.map((post) => (
<li><a href={post.permalink}><img src={post.src} srcset={post.srcset} alt={post.alt} loading="lazy" /></a></li>
))}
</ul>
)}
It returns null if the feed can't be fetched within 2 seconds. Options: limit, look, siteKey,
cacheSeconds, timeoutMs and apiOrigin. Each post has id, type, permalink,
caption, captionText (without hashtags), timestamp, alt, src and srcset.
To draw the standard markup yourself, outside Astro, use the same renderer:
import { getFeed, normaliseSettings, renderFeed, FEED_CSS } from "@ninetysixsoftware/social-feeds";
const feed = await getFeed("your-feed-id");
const html = feed
? `<style>${FEED_CSS}</style>` + renderFeed(feed, normaliseSettings(feed.settings, { layout: "grid" }))
: "";
// In the browser, for arrows, dragging, Show more and the lightbox:
// import { enhanceAll } from "@ninetysixsoftware/social-feeds/behaviour"
// enhanceAll(document)
The site key
A site key (nsk_...) lets the Social Feeds admin page in EmDash manage the feed. Starting a trial or linking your
account there saves it for you. You can also make one in your Social Feeds account and paste it into the admin page.
The component works without one, because the feed is public. Set SOCIAL_FEEDS_KEY as a secret (or
SOCIAL_FEEDS_KEY_<FEED_ID> per feed, in capitals with dashes as underscores) so your site is rate limited on its own.
On Cloudflare that's npx wrangler secret put SOCIAL_FEEDS_KEY. Never put a key in browser code or commit it.
Plan limits
| Site | Pro | Agency | |
|---|---|---|---|
| Sites | 1 | 1 | 15, then $3 a month per extra site |
| Feeds per site | 1 | 5 | 5 |
| Posts per feed | 8 | 24 | 50 |
| Updates | Hourly | Every 15 minutes | Every 15 minutes |
| Views | No limit | No limit | No limit |
| Lightbox | No | Yes | Yes |
Local and staging addresses don't use a site, up to 5 per account. Every plan starts with a 14-day free trial. See plan limits in the help.