From 0c0bce368810862f28119b29f6a2d5796f6fe2da Mon Sep 17 00:00:00 2001 From: Tobias Schmidl Date: Tue, 15 Oct 2024 08:35:51 +0200 Subject: [PATCH 1/2] small bugfix, as the Writer no longer as the site_url --- activitypub.py | 7 ++++--- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/activitypub.py b/activitypub.py index f2b9e7c..ed0145d 100644 --- a/activitypub.py +++ b/activitypub.py @@ -4,6 +4,7 @@ import logging import json import os import urllib.parse +import pelican.writers from pelican import signals @@ -11,12 +12,12 @@ from pelican import signals log = logging.getLogger(__name__) -__version__ = '0.1' +__version__ = '0.1.1' pagination = 25 -def ap_article(generator, writer): +def ap_article(generator: pelican.ArticlesGenerator, writer: pelican.writers.Writer): now = datetime.datetime.utcnow() @@ -43,7 +44,7 @@ def ap_article(generator, writer): wknodeinfo = { 'links': [ { - 'href': os.path.join(writer.site_url, 'activitypub/nodeinfo'), + 'href': os.path.join(generator.settings['SITEURL'], 'activitypub/nodeinfo'), 'rel': 'http://nodeinfo.diaspora.software/ns/schema/2.0' } ] diff --git a/pyproject.toml b/pyproject.toml index a9480b0..531672d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ [project] name = "pelican-plugin-activitypub" -version = "0.1.0" +version = "0.1.1" description = "Pelican plugin implementing Activitypub" authors = [{name = "s3lph", email = "s3lph@kabelsalat.ch"}, {name = "Tobias Schmidl", email = "tobias@schmidl.dev"}] license = { text = "MIT" } From 604f9ff8f27d39332a467e037467c1d5a273bb68 Mon Sep 17 00:00:00 2001 From: Tobias Schmidl Date: Tue, 15 Oct 2024 09:01:15 +0200 Subject: [PATCH 2/2] another bugfix, as article.tags is no longer valid --- activitypub.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activitypub.py b/activitypub.py index ed0145d..9205535 100644 --- a/activitypub.py +++ b/activitypub.py @@ -106,7 +106,7 @@ def ap_article(generator: pelican.ArticlesGenerator, writer: pelican.writers.Wri path = os.path.join(writer.output_path, 'activitypub/tags', t.slug) articles = [] for article in generator.articles: - if t.name not in article.tags: + if t.name not in article.metadata['tags']: continue articles.append( os.path.join(generator.settings['SITEURL'], 'activitypub/posts', article.slug) @@ -126,7 +126,7 @@ def ap_article(generator: pelican.ArticlesGenerator, writer: pelican.writers.Wri aurl = os.path.join(generator.settings['SITEURL'], 'activitypub/posts', article.slug) apath = os.path.join(writer.output_path, 'activitypub/posts', article.slug) tags = [] - for tag in article.tags: + for tag in article.metadata.get('tags', []): tags.append({ 'type': 'Hashtag', 'name': '#' + tag.slug,