diff --git a/action_script/syndication-adder.py b/action_script/syndication-adder.py index 61995873..221563df 100644 --- a/action_script/syndication-adder.py +++ b/action_script/syndication-adder.py @@ -9,7 +9,23 @@ CARTELLA_POST = "content" CSV_LOG = "log_feed.csv" MASTODON_FEED = "https://mastodon.social/users/fundor333.rss" BSKY_FEED = "https://bsky.app/profile/did:plc:u7piwonv4s27ysugjaa6im2q/rss" # facoltativo, se disponibile -MEDIUM_FEED = "https://medium.com/feed/@fundor333" +MEDIUM_FEED = None # "https://medium.com/feed/@fundor333" + + +def parse_fediverse_url(url): + # Mastodon / Akkoma / Pleroma + match1 = re.match(r"https?://([^/]+)/@([^/]+)/(\d+)", url) + if match1: + host, username, post_id = match1.groups() + return {"host": host, "username": username, "id": post_id} + + # Misskey / Firefish + match2 = re.match(r"https?://([^/]+)/notes/([a-zA-Z0-9]+)", url) + if match2: + host, post_id = match2.groups() + return {"host": host, "username": None, "id": post_id} + + return None def process_feed_medium(feed_url, fonte): @@ -83,7 +99,7 @@ def aggiungi_syndication_a_post(percorso_file, nuovi_link): content = f.read() if content.startswith("+++"): - raise NotImplementedError("Supporto TOML non ancora gestito.") + raise NotImplementedError("Supporto TOML non gestito.") elif content.startswith("---"): parts = content.split("---") if len(parts) < 3: @@ -92,6 +108,8 @@ def aggiungi_syndication_a_post(percorso_file, nuovi_link): frontmatter = yaml.safe_load(parts[1]) esistenti = frontmatter.get("syndication", []) + if isinstance(esistenti, str): + esistenti = [esistenti] esistenti_norm = set(map(normalizza_url, esistenti)) nuovi_norm = set(map(normalizza_url, nuovi_link)) @@ -99,7 +117,17 @@ def aggiungi_syndication_a_post(percorso_file, nuovi_link): da_aggiungere = list(nuovi_norm - esistenti_norm) if da_aggiungere: + # Aggiorna il campo syndication frontmatter["syndication"] = sorted(esistenti_norm.union(nuovi_norm)) + + # Se troviamo un link Mastodon, estrai info nei meta commenti + for link in da_aggiungere: + parsed = parse_fediverse_url(link) + if parsed: + frontmatter["comments"] = ( + parsed # Sostituisce se giĆ  esiste (puoi estendere a lista se vuoi) + ) + nuovo_frontmatter = yaml.dump( frontmatter, sort_keys=False, allow_unicode=True ) diff --git a/archetypes/post.md b/archetypes/post.md index 8aca067a..2924db4d 100644 --- a/archetypes/post.md +++ b/archetypes/post.md @@ -27,10 +27,5 @@ repost: like: rsvp: bookmark: - -comments: - host: mastodon.social - username: fundor333 - id: --- diff --git a/content/micro/2025/05/question-about-echofeed/index.md b/content/micro/2025/05/question-about-echofeed/index.md index 46cb0518..8d2dddae 100644 --- a/content/micro/2025/05/question-about-echofeed/index.md +++ b/content/micro/2025/05/question-about-echofeed/index.md @@ -16,7 +16,7 @@ bookmark: null comments: host: mastodon.social username: fundor333 - id: null + id: '114587857806058272' syndication: - https://bsky.app/profile/fundor333.bsky.social/post/3lroqnpvein2o - https://mastodon.social/@fundor333/114587857806058272 diff --git a/content/micro/2025/06/dnd-colorcoding/index.md b/content/micro/2025/06/dnd-colorcoding/index.md index 7a7b0ff2..1ca10005 100644 --- a/content/micro/2025/06/dnd-colorcoding/index.md +++ b/content/micro/2025/06/dnd-colorcoding/index.md @@ -15,7 +15,7 @@ bookmark: null comments: host: mastodon.social username: fundor333 - id: 114627452417111937 + id: '114627452417111937' syndication: - https://bsky.app/profile/fundor333.bsky.social/post/3lroqna6rpn2o - https://mastodon.social/@fundor333/114627452417111937 diff --git a/content/micro/2025/06/dnd-hosting/index.md b/content/micro/2025/06/dnd-hosting/index.md index 731067d4..af3756c6 100644 --- a/content/micro/2025/06/dnd-hosting/index.md +++ b/content/micro/2025/06/dnd-hosting/index.md @@ -16,7 +16,7 @@ bookmark: null comments: host: mastodon.social username: fundor333 - id: 114689671753564243 + id: '114689671753564243' syndication: - https://bsky.app/profile/fundor333.bsky.social/post/3lroici3xqz22 - https://mastodon.social/@fundor333/114689671753564243 diff --git a/content/micro/2025/06/taxidermy/index.md b/content/micro/2025/06/taxidermy/index.md index 8e639d14..071daef7 100644 --- a/content/micro/2025/06/taxidermy/index.md +++ b/content/micro/2025/06/taxidermy/index.md @@ -12,7 +12,7 @@ bookmark: null comments: host: mastodon.social username: fundor333 - id: null + id: '114615017065338141' syndication: - https://mastodon.social/@fundor333/114615017065338141 --- diff --git a/content/micro/2025/06/umami-start/index.md b/content/micro/2025/06/umami-start/index.md index 2c1c565f..528c739d 100644 --- a/content/micro/2025/06/umami-start/index.md +++ b/content/micro/2025/06/umami-start/index.md @@ -15,7 +15,7 @@ bookmark: null comments: host: mastodon.social username: fundor333 - id: 114681429148697486 + id: '114681429148697486' syndication: - https://bsky.app/profile/fundor333.bsky.social/post/3lrkt66xamq2s - https://mastodon.social/@fundor333/114681429148697486 diff --git a/content/post/2021/static-with-a-form/index.md b/content/post/2021/static-with-a-form/index.md index 6b19bd7c..64082212 100644 --- a/content/post/2021/static-with-a-form/index.md +++ b/content/post/2021/static-with-a-form/index.md @@ -13,6 +13,7 @@ categories: - fingerfood description: If you have a static site you can also have forms syndication: +- https://fundor333.medium.com/static-with-a-form-in-python-0a11c50a04cd?source=rss-48447ba4c2e - https://fundor333.medium.com/static-with-a-form-in-python-0a11c50a04cd?source=rss-48447ba4c2e------2 --- diff --git a/content/post/2025/add-minor-things-to-django/index.md b/content/post/2025/add-minor-things-to-django/index.md index b397cae8..100225a4 100644 --- a/content/post/2025/add-minor-things-to-django/index.md +++ b/content/post/2025/add-minor-things-to-django/index.md @@ -23,7 +23,7 @@ bookmark: null comments: host: mastodon.social username: fundor333 - id: 114689582471095983 + id: '114689582471095983' syndication: - https://mastodon.social/@fundor333/114689582471095983 --- diff --git a/content/post/2025/so-this-is-why-i-sometime-reset-the-feed-reader-of-friends/index.md b/content/post/2025/so-this-is-why-i-sometime-reset-the-feed-reader-of-friends/index.md index 577e155b..7bd67876 100644 --- a/content/post/2025/so-this-is-why-i-sometime-reset-the-feed-reader-of-friends/index.md +++ b/content/post/2025/so-this-is-why-i-sometime-reset-the-feed-reader-of-friends/index.md @@ -23,7 +23,7 @@ bookmark: null comments: host: mastodon.social username: fundor333 - id: 114690259109867675 + id: '114690259109867675' syndication: - https://mastodon.social/@fundor333/114690259109867675 --- diff --git a/content/post/2025/this-is-why-instagram-ruin-itself/index.md b/content/post/2025/this-is-why-instagram-ruin-itself/index.md index 24d99ab4..6a69b6e3 100644 --- a/content/post/2025/this-is-why-instagram-ruin-itself/index.md +++ b/content/post/2025/this-is-why-instagram-ruin-itself/index.md @@ -18,6 +18,7 @@ feature_text: by IA Midjourney series: - Tech News syndication: +- https://fundor333.medium.com/this-is-why-instagram-ruin-itself-5e939a3bd4c6?source=rss-48447ba4c2e - https://fundor333.medium.com/this-is-why-instagram-ruin-itself-5e939a3bd4c6?source=rss-48447ba4c2e------2 --- diff --git a/content/post/2025/webring-into-2025/index.md b/content/post/2025/webring-into-2025/index.md index ecb9946f..23c1ad8b 100644 --- a/content/post/2025/webring-into-2025/index.md +++ b/content/post/2025/webring-into-2025/index.md @@ -23,7 +23,7 @@ bookmark: https://mxb.dev/blog/webring-kit/ comments: host: mastodon.social username: fundor333 - id: 114565534042467712 + id: '114565534042467712' syndication: - https://bsky.app/profile/fundor333.bsky.social/post/3lpxe75uzk52r - https://mastodon.social/@fundor333/114565534042467712 diff --git a/content/weeknotes/2025/21.md b/content/weeknotes/2025/21.md index f53a1942..9970cb9b 100644 --- a/content/weeknotes/2025/21.md +++ b/content/weeknotes/2025/21.md @@ -10,6 +10,10 @@ draft: false syndication: - https://bsky.app/profile/fundor333.bsky.social/post/3lroqnv2r652s - https://mastodon.social/@fundor333/114690259884567597 +comments: + host: mastodon.social + username: fundor333 + id: '114690259884567597' --- - Changing some metadata for better control of what brid.gy publish from my site diff --git a/content/weeknotes/2025/22.md b/content/weeknotes/2025/22.md index b20852ec..4d76eb57 100644 --- a/content/weeknotes/2025/22.md +++ b/content/weeknotes/2025/22.md @@ -10,6 +10,10 @@ draft: false syndication: - https://bsky.app/profile/fundor333.bsky.social/post/3lroqnfmvut2y - https://mastodon.social/@fundor333/114690258752401420 +comments: + host: mastodon.social + username: fundor333 + id: '114690258752401420' --- - Making some videoediting for a friend diff --git a/content/weeknotes/2025/23.md b/content/weeknotes/2025/23.md index 9e74f98f..a1b63e8f 100644 --- a/content/weeknotes/2025/23.md +++ b/content/weeknotes/2025/23.md @@ -10,6 +10,10 @@ draft: false syndication: - https://bsky.app/profile/fundor333.bsky.social/post/3lr3n2pfd7f23 - https://mastodon.social/@fundor333/114647222339157952 +comments: + host: mastodon.social + username: fundor333 + id: '114647222339157952' --- - And I went to vote for the Referendum diff --git a/content/weeknotes/2025/24.md b/content/weeknotes/2025/24.md index 581a3a75..438a62c8 100644 --- a/content/weeknotes/2025/24.md +++ b/content/weeknotes/2025/24.md @@ -10,6 +10,10 @@ draft: false syndication: - https://bsky.app/profile/fundor333.bsky.social/post/3lroqmzb3zz2w - https://mastodon.social/@fundor333/114690257976586167 +comments: + host: mastodon.social + username: fundor333 + id: '114690257976586167' --- - Setup Umami for my personals' sites diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html index 7aff8792..aef4ea36 100644 --- a/layouts/partials/comments.html +++ b/layouts/partials/comments.html @@ -8,7 +8,7 @@ {{ partial "webmention" . }} {{ $params := .Params.comments }} -{{ with .Params.comments.id}} +{{ with .Params.comments}} {{ partial "mastodon" $params }} {{ end }}