Skip to content

Twitter should render image of snippet when snippet url shared #237

@chriswedgwood

Description

@chriswedgwood
Collaborator

@chriswedgwood — we should probably have a new ticket — derailing the Roadmap discussion — but 😀 — Ideally...

  • I'd share the django snippets (detail view) URL on twitter.
  • I could type my tweet.
  • If would display a nice render of the code.
  • But the key is that the link goes back to DS, where I can interact and copy the code.

For the image bit:

  • Not sure best way to generate it. Carbon is just what folks are using from this POV. Can we leverage it? Or do we do something with PIL? (It doesn't need to have every theme option and such of Carbon, if we do use PIL)
  • Not sure if we need to post the image to twitter, or can just use the OG tags. (I'd try the 2nd first, as it's clearly easier).

If I could use the same for blog posts and such — image, plus link back to editable snippet — that would cool. 🤔

I need to have a potter around Carbon to see what's possible there.

Originally posted by @carltongibson in #210 (comment)

Activity

chriswedgwood

chriswedgwood commented on Mar 25, 2021

@chriswedgwood
CollaboratorAuthor

@carltongibson I'll play around with whats possible as well and come up with some options.

carltongibson

carltongibson commented on Mar 25, 2021

@carltongibson
Member

Super — thanks @chriswedgwood!

Just thinking out-loud, a one-theme option where we generate the image ourselves might be nice (part of DS is to be an example of how it's done.) Happy to input — comment here with whatever findings you make and we can discuss. 😀

chriswedgwood

chriswedgwood commented on Mar 25, 2021

@chriswedgwood
CollaboratorAuthor

Super — thanks @chriswedgwood!

Just thinking out-loud, a one-theme option where we generate the image ourselves might be nice (part of DS is to be an example of how it's done.) Happy to input — comment here with whatever findings you make and we can discuss. 😀

Yes we can configure a carbon theme for DS

carltongibson

carltongibson commented on Mar 25, 2021

@carltongibson
Member

Pygment's ImageFormatter already does the hard bit.

jefftriplett

jefftriplett commented on Mar 25, 2021

@jefftriplett
SponsorMember

Carbon’s API story wasn't as good as I had remembered, so Pygments is the better way to go. Plus, having a Django Snippets theme is better anyways IMO.

carbon-app/carbon#210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @jefftriplett@carltongibson@chriswedgwood

      Issue actions

        Twitter should render image of snippet when snippet url shared · Issue #237 · django/djangosnippets.org