Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import TILs as blogmarks #283

Open
simonw opened this issue Sep 19, 2022 · 4 comments
Open

Import TILs as blogmarks #283

simonw opened this issue Sep 19, 2022 · 4 comments

Comments

@simonw
Copy link
Owner

simonw commented Sep 19, 2022

Having a separate https://til.simonwillison.net/ blog for TILs means I have content that isn't represented in my main blog (aside from when I link to them in my weeknotes).

I want to automatically populate a blogmark for each TIL. I can use a similar approach to this one for that: https://github.com/simonw/simonwillisonblog/blob/main/blog/management/commands/import_blog_json.py

I wrote about that here: https://simonwillison.net/2017/Nov/4/import-refs/

@simonw
Copy link
Owner Author

simonw commented Sep 19, 2022

It already has the ability to import blogmarks:

elif item["type"] == "blogmark":
klass = Blogmark
kwargs = dict(
slug=slug,
link_url=item["link_url"],
link_title=item["link_title"],
via_url=item.get("via_url") or "",
via_title=item.get("via_title") or "",
commentary=item["commentary"] or "",
created=created,
metadata=item,
)

And import_ref can be used to avoid importing the same thing twice:

if item.get("import_ref"):
obj, was_created = klass.objects.update_or_create(
import_ref=item["import_ref"], defaults=kwargs
)

So... I could teach it to pull a feed from https://til.simonwillison.net/ in response to a POST to some endpoint.

@simonw
Copy link
Owner Author

simonw commented Sep 19, 2022

@simonw
Copy link
Owner Author

simonw commented Sep 19, 2022

Five of my blogmarks are already to TILs: https://simonwillison.net/dashboard/?sql=select+%2A+from+blog_blogmark+where+link_url+like+%27https%3A%2F%2Ftil.simonwillison.net%25%25%27%3AA14XB8ah9tdq44NaEbKMaLFU3Q7RYbfOm3ZBoEh_iKU - I could update these in the Django admin with the expected import_ref to avoid creating duplicates.

@simonw
Copy link
Owner Author

simonw commented Sep 19, 2022

One catch: what should the link description be?

A few options:

  • Take the first paragraph of the TIL, with tags stripped - like on https://til.simonwillison.net/datasette
  • Go back through all 324 existing TILs and add a short summary to each one
  • The fun one: get GPT-3 to create summaries for everything and then manually write summaries going forward

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

No branches or pull requests

1 participant