Compare commits
2 commits
8678a764d7
...
604f9ff8f2
Author | SHA1 | Date | |
---|---|---|---|
604f9ff8f2 | |||
0c0bce3688 |
2 changed files with 7 additions and 6 deletions
|
@ -4,6 +4,7 @@ import logging
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
import pelican.writers
|
||||||
|
|
||||||
from pelican import signals
|
from pelican import signals
|
||||||
|
|
||||||
|
@ -11,12 +12,12 @@ from pelican import signals
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
__version__ = '0.1'
|
__version__ = '0.1.1'
|
||||||
|
|
||||||
pagination = 25
|
pagination = 25
|
||||||
|
|
||||||
|
|
||||||
def ap_article(generator, writer):
|
def ap_article(generator: pelican.ArticlesGenerator, writer: pelican.writers.Writer):
|
||||||
|
|
||||||
now = datetime.datetime.utcnow()
|
now = datetime.datetime.utcnow()
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ def ap_article(generator, writer):
|
||||||
wknodeinfo = {
|
wknodeinfo = {
|
||||||
'links': [
|
'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'
|
'rel': 'http://nodeinfo.diaspora.software/ns/schema/2.0'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -105,7 +106,7 @@ def ap_article(generator, writer):
|
||||||
path = os.path.join(writer.output_path, 'activitypub/tags', t.slug)
|
path = os.path.join(writer.output_path, 'activitypub/tags', t.slug)
|
||||||
articles = []
|
articles = []
|
||||||
for article in generator.articles:
|
for article in generator.articles:
|
||||||
if t.name not in article.tags:
|
if t.name not in article.metadata['tags']:
|
||||||
continue
|
continue
|
||||||
articles.append(
|
articles.append(
|
||||||
os.path.join(generator.settings['SITEURL'], 'activitypub/posts', article.slug)
|
os.path.join(generator.settings['SITEURL'], 'activitypub/posts', article.slug)
|
||||||
|
@ -125,7 +126,7 @@ def ap_article(generator, writer):
|
||||||
aurl = os.path.join(generator.settings['SITEURL'], 'activitypub/posts', article.slug)
|
aurl = os.path.join(generator.settings['SITEURL'], 'activitypub/posts', article.slug)
|
||||||
apath = os.path.join(writer.output_path, 'activitypub/posts', article.slug)
|
apath = os.path.join(writer.output_path, 'activitypub/posts', article.slug)
|
||||||
tags = []
|
tags = []
|
||||||
for tag in article.tags:
|
for tag in article.metadata.get('tags', []):
|
||||||
tags.append({
|
tags.append({
|
||||||
'type': 'Hashtag',
|
'type': 'Hashtag',
|
||||||
'name': '#' + tag.slug,
|
'name': '#' + tag.slug,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "pelican-plugin-activitypub"
|
name = "pelican-plugin-activitypub"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
description = "Pelican plugin implementing Activitypub"
|
description = "Pelican plugin implementing Activitypub"
|
||||||
authors = [{name = "s3lph", email = "s3lph@kabelsalat.ch"}, {name = "Tobias Schmidl", email = "tobias@schmidl.dev"}]
|
authors = [{name = "s3lph", email = "s3lph@kabelsalat.ch"}, {name = "Tobias Schmidl", email = "tobias@schmidl.dev"}]
|
||||||
license = { text = "MIT" }
|
license = { text = "MIT" }
|
||||||
|
|
Loading…
Reference in a new issue