all repos — nasg @ 513052d813af91e3a19f6c00565f46d3ea69d875

- removed json-ld test thingie
- added static file copy per folder for attachments
Peter Molnar hello@petermolnar.eu
Mon, 01 Oct 2018 10:33:07 +0100
commit

513052d813af91e3a19f6c00565f46d3ea69d875

parent

1cd0308bb56f7cf2cf4c831c7d6ca3b62ef0d370

3 files changed, 21 insertions(+), 68 deletions(-)

jump to
M nasg.pynasg.py

@@ -582,14 +582,31 @@ #settings.logger.info("updating %s", fpath)

#f.write(frontmatter.dumps(fm)) async def copyfiles(self): - copystatics( os.path.dirname(self.fpath)) + exclude=['.md', '.jpg', '.png', '.gif']; + files = glob.glob(os.path.join( + os.path.dirname(self.fpath), + '*.*' + )) + for f in files: + fname, fext = os.path.splitext(f) + if fext.lower() in exclude: + continue + + t = os.path.join( + settings.paths.get('build'), + self.name, + os.path.basename(f) + ) + if os.path.exists(t) and os.path.getmtime(f) <= os.path.getmtime(t): + continue + settings.logger.info("copying '%s' to '%s'", f, t) + cp(f, t) async def render(self): if self.exists: return settings.logger.info("rendering %s", self.name) r = J2.get_template(self.template).render({ - 'jsonld': settings.jsonld, 'post': self.tmplvars, 'site': settings.site, 'author': settings.author,

@@ -1073,7 +1090,6 @@ return 'Search.j2.php'

async def _render(self): r = J2.get_template(self.templatefile).render({ - 'jsonld': settings.jsonld, 'post': {}, 'site': settings.site, 'author': settings.author,

@@ -1318,7 +1334,6 @@ end = int(start + pagination)

posts = self.get_posts(start, end) r = J2.get_template(self.template).render({ - 'jsonld': settings.jsonld, 'site': settings.site, 'author': settings.author, 'meta': settings.meta,

@@ -1375,23 +1390,6 @@ if self.mtime >= sorted(self.values())[-1]:

return with open(self.renderfile, 'wt') as f: f.write("\n".join(sorted(self.keys()))) - -def copystatics(source, exclude=['.md', '.jpg', '.png', '.gif']): - files = glob.glob(os.path.join( - source, '*.*' - )) - for f in files: - fname, fext = os.path.splitext(f) - if fext.lower() in exclude: - continue - t = os.path.join( - settings.paths.get('build'), - os.path.basename(f) - ) - if os.path.exists(t) and os.path.getmtime(f) <= os.path.getmtime(t): - continue - settings.logger.info("copying '%s' to '%s'", f, t) - cp(f, t) def mkcomment(webmention): if 'published_ts' in webmention.get('data'):

@@ -1556,8 +1554,8 @@ # copy static

staticfiles = [] staticpaths = [ os.path.join(content, '*.*'), - os.path.join(settings.paths.get('tmpl'), '*.js'), - os.path.join(settings.paths.get('tmpl'), '*.css') + #os.path.join(settings.paths.get('tmpl'), '*.js'), + #os.path.join(settings.paths.get('tmpl'), '*.css') ] for p in staticpaths: staticfiles = staticfiles + glob.glob(p)
M settings.pysettings.py

@@ -54,48 +54,6 @@ 'github': 'https://github.com/petermolnar',

} } -jsonld = { - '@context': 'http://schema.org', - '@type': 'ProfessionalService', - '@id': author.get('url'), - 'name' : 'Peter Molnar web services consultancy', - 'url': author.get('url'), - 'email': author.get('email'), - 'telephone': "00447592011721", - 'image' : 'https://petermolnar.net/logo.jpg', - 'description' : 'WordPress, IT backend services, and infrastructure consultancy for web- and bigdata stacks.', - 'logo': { - '@type': 'ImageObject', - 'url': 'https://petermolnar.net/logo.jpg' - }, - 'sameAs' : [ - 'https://github.com/petermolnar', - 'https://www.linkedin.com/in/petermolnareu', - ], - 'address': { - '@type': 'PostalAddress', - 'addressLocality': 'Cambridge', - 'addressCountry': 'GB' - }, - 'contactPoint': [ - { - '@type': 'ContactPoint', - 'email': 'mail@petermolnar.net', - 'url': 'https://petermolnar.net/about.html', - 'contactType': 'customer service', - 'availableLanguage': { - '@type': 'Language', - 'name': [ - 'Magyar', - 'English' - ] - } - } - ], - 'priceRange': 'from £50/hour' -} - - paths = { 'content': os.path.join(base, 'content'), 'webmentions': os.path.join(base, 'content', 'webmentions'),
M templates/base.j2.htmltemplates/base.j2.html

@@ -35,9 +35,6 @@ e.setAttribute("media", setto);

return false; } </script> - <script type="application/ld+json"> - {{ jsonld|tojson(4) }} - </script> </head> <body itemscope="" itemtype="http://schema.org/Blog http://schema.org/WebPage">