Browse Source

add opengraph metadata

Getty Ritter 2 years ago
parent
commit
cff1c32d5b
1 changed files with 12 additions and 1 deletions
  1. 12 1
      main.py

+ 12 - 1
main.py

@@ -107,6 +107,11 @@ def main():
                 'title': f"Quip",
                 'contents': Template.quote({'quotelist': [q]}),
                 'copy': no_copy,
+                'opengraph': {
+                    'title': f'quip:{uuid}',
+                    'url': f'/quip/{uuid}/',
+                    'description': q.content,
+                },
             }))
 
     # sort 'em and make the combined page
@@ -124,10 +129,16 @@ def main():
         q = Quote.from_file(Path.data('quotes', uuid))
         quotes.append(q)
         with Path.write('quotes', uuid, 'index.html') as f:
+            contents = Template.quote({'quotelist': [q]})
             f.write(Template.main({
                 'title': f"Quote",
-                'contents': Template.quote({'quotelist': [q]}),
+                'contents': contents,
                 'copy': no_copy,
+                'opengraph': {
+                    'title': f'quote:{uuid}',
+                    'url': f'/quote/{uuid}/',
+                    'description': f'{q.content}\n---{q.author}',
+                },
             }))
 
     # sort 'em and make their combined page