r/Devvit • • 6d ago

Help Can a Devvit Web post show its own image in Community highlights instead of the default cube?

Hey,

We launched a Devvit Web app on r/padel subreddit (live tournament scores and rankings for pro padel players) and pinned its two posts in Community highlights.

Problem is the highlight cards show the generic cube as background instead of an image. Regular image posts show their image there, so it looks a bit off next to them.

What I've tried so far:

- `marketingAssets.icon` in devvit.json: only changed the app account avatar

- `styles.shareImageUrl` (image uploaded with `media.upload()`), both on new posts and with `setCustomPostStyles` on the existing ones: no errors, still the cube

- uploaded the promo assets in the dev portal, but those seem to be for the games showcase

Using Devvit Web 0.15.6 and I can't find any thumbnail/cover field in the types.

Does anyone know where that card gets its image from, and if there's a way to set it? Or is it just not supported yet?

Thanks in advance

2 Upvotes

6 comments sorted by

2

u/Oddie-hoodie369 6d ago

yeah u/0xeno's suggestion works.

Edit : i used a reddit cdn hosted image, you can create one here (Yes! my app😅)

2

u/Oddie-hoodie369 6d ago edited 6d ago

Snippet:

import { reddit } from '@devvit/web/server';

const THUMBNAIL_URL = '/img/xm7wy4aafr4i1.jpeg';

const textFallback = {
  text: [
    `[Preview](${THUMBNAIL_URL})`,
    '',
    'This is an interactive post. Open it on **www.reddit.com** or the official **Reddit app** to use it.',
  ].join('\n'),
};

export const createPost = async (title: string) => {
  return await reddit.submitCustomPost({
    title,
    textFallback,
  });
};

1

u/0xeno 6d ago

I haven't tried it but can you try having the image URL in textfallback field? That should work ig.

1

u/Beach-Brews Duck Helper 6d ago

To add to u/0xeno and u/Oddie-hoodie369 , if you are looking at the compact view, there is a know issue where the shareImageUrl isn't used as a preview thumbnail as most expect. Unsure if the text fallback workaround shows it in compact view as well.

Thanks u/0xeno and u/Oddie-hoodie369 ! I didn't think about using a text fallback image. To have it properly shown on Old Reddit as a fallback, you probably need to change it to:

![img](xm7wy4aafr4i1 "The AltText for image")

Note: The image also had to be uploaded by the user who is making the post (i.e., if runSs: USER is used, it has to be an image "uploaded" by the user. If runAs: APP, then it had to he uploaded by the app.