fixes, cleanup

This commit is contained in:
randogoth 2023-05-03 00:21:33 +03:00
parent 041b2608d5
commit a8c4913437
61 changed files with 54 additions and 2648 deletions

View file

@ -1,6 +1,8 @@
from pelican import signals
import geohash_tools as gh
hashes = []
def generate_geohash(generator):
for article in generator.articles:
if "location" in article.metadata:
@ -8,7 +10,9 @@ def generate_geohash(generator):
article.metadata['lat'] = lat
article.metadata['lon'] = lon
article.metadata['geohash'] = gh.encode(lat, lon, 11)
article.slug = gh.encode(lat, lon, 11)
if article.metadata['geohash'] not in hashes:
article.slug = gh.encode(lat, lon, 11)
hashes.append(article.metadata['geohash'])
def register():
signals.article_generator_finalized.connect(generate_geohash)