@rmdes/indiekit-endpoint-syndicate 1.0.0-beta.37 → 1.0.0-beta.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,10 +34,15 @@ const syndicatePost = async ({
34
34
  }) => {
35
35
  // Readiness gate: verify post and OG image are live before syndicating.
36
36
  // Skip check in force mode (manual re-syndication from UI/backlog script).
37
+ // Photo posts skip OG check — Eleventy deliberately skips OG generation
38
+ // for posts with photos (the photo itself serves as og:image in HTML).
37
39
  const meUrl = typeof publication.me === "string" ? publication.me : publication.me?.href || publication.me?.toString?.() || "";
40
+ const hasPhotos = Array.isArray(postData.properties?.photo) && postData.properties.photo.length > 0;
38
41
  if (!force && meUrl && postData.properties?.url) {
39
- console.log(`[syndication] Readiness gate: checking ${postData.properties.url} (me=${meUrl})`);
40
- const readiness = await isPostReady(postData.properties.url, meUrl);
42
+ console.log(`[syndication] Readiness gate: checking ${postData.properties.url} (me=${meUrl}, hasPhotos=${hasPhotos})`);
43
+ const readiness = hasPhotos
44
+ ? await isPostReady(postData.properties.url, meUrl, { skipOg: true })
45
+ : await isPostReady(postData.properties.url, meUrl);
41
46
  if (!readiness.ready) {
42
47
  console.log(
43
48
  `[syndication] Skipping ${postData.properties.url} — not yet built ` +
package/lib/utils.js CHANGED
@@ -142,8 +142,12 @@ export const syndicateToTargets = async (
142
142
  }
143
143
  })
144
144
  .map((t) => t.info.uid);
145
+ } else {
146
+ // Fall back to targets marked as checked by default
147
+ syndicateTo = syndicationTargets
148
+ .filter((t) => t?.options?.checked)
149
+ .map((t) => t.info.uid);
145
150
  }
146
- // If no existing syndication URLs, don't default to all — leave empty
147
151
  }
148
152
 
149
153
  // BUG FIX: Was `Array.isArray` (always truthy, it's a function reference)
@@ -254,12 +258,16 @@ export function urlToOgSlug(postUrl) {
254
258
  *
255
259
  * @param {string} postUrl - Full public URL of the post
256
260
  * @param {string} me - Publication URL (e.g., "https://rmendes.net")
261
+ * @param {object} [options] - Options
262
+ * @param {boolean} [options.skipOg] - Skip OG image check (e.g., photo posts
263
+ * where Eleventy uses the photo itself as og:image instead of generating /og/*.png)
257
264
  * @returns {Promise<{ready: boolean, postStatus: number, ogStatus: number}>}
258
265
  */
259
- export async function isPostReady(postUrl, me) {
266
+ export async function isPostReady(postUrl, me, options = {}) {
267
+ const { skipOg = false } = options;
260
268
  const ogSlug = urlToOgSlug(postUrl);
261
269
  const meNorm = me?.replace(/\/$/, "");
262
- const ogUrl = ogSlug && meNorm ? `${meNorm}/og/${ogSlug}.png` : null;
270
+ const ogUrl = !skipOg && ogSlug && meNorm ? `${meNorm}/og/${ogSlug}.png` : null;
263
271
 
264
272
  const headCheck = async (url) => {
265
273
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-syndicate",
3
- "version": "1.0.0-beta.37",
3
+ "version": "1.0.0-beta.38",
4
4
  "description": "Syndication endpoint for Indiekit. Fork of @indiekit/endpoint-syndicate with batch syndication support and bug fixes.",
5
5
  "keywords": [
6
6
  "indiekit",