diff --git a/Pipfile b/Pipfile index 4c62010..f55b27d 100644 --- a/Pipfile +++ b/Pipfile @@ -14,6 +14,7 @@ gunicorn = "*" pillow = "*" python-memcached = "*" django-favicon-plus = "*" +django-meta = "*" [dev-packages] diff --git a/Pipfile.lock b/Pipfile.lock index 0c9248d..73006ad 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "388a82f0237a5312720d62a0aeee6365922fc525d666039e15ba70000430630c" + "sha256": "60ee6c91a6c7b88c2a424a70428f3f380adc142716ebe82ce35f31a10cedeb3c" }, "host-environment-markers": { "implementation_name": "cpython", @@ -60,6 +60,13 @@ ], "version": "==0.0.7" }, + "django-meta": { + "hashes": [ + "sha256:2a5b8d95099f69fb9736630c4fbf4fcc2972a1fcd9c708a5bb72dde22e84d8dd", + "sha256:4a7dc51c40fd6a097825040af29ee0e049f1fce29b006e39f266f80ba988bac6" + ], + "version": "==1.4" + }, "gunicorn": { "hashes": [ "sha256:75af03c99389535f218cc596c7de74df4763803f7b63eb09d77e92b3956b36c6", diff --git a/home/views.py b/home/views.py index adbe89c..9bc157c 100644 --- a/home/views.py +++ b/home/views.py @@ -4,4 +4,7 @@ from users.models import User def index(request): user = get_object_or_404(User, pk=1) - return render(request, 'home/index.html', {'user': user}) + return render(request, 'home/index.html', { + 'user': user, + 'meta': user.as_meta(request), + }) diff --git a/lemoncurry/settings/base.py b/lemoncurry/settings/base.py index d6283a6..2298d94 100644 --- a/lemoncurry/settings/base.py +++ b/lemoncurry/settings/base.py @@ -66,6 +66,7 @@ INSTALLED_APPS = [ 'compressor', 'favicon', + 'meta', 'lemoncurry', 'home', @@ -182,3 +183,10 @@ MEDIA_ROOT = os.path.join(STATIC_ROOT, 'media') # Settings specific to lemoncurry LEMONCURRY_SITE_NAME = '00dani.me' + +# django-meta +# https://django-meta.readthedocs.io/en/latest/settings.html +META_SITE_PROTOCOL = 'https' +META_SITE_NAME = LEMONCURRY_SITE_NAME +META_USE_OG_PROPERTIES = True +META_USE_TWITTER_PROPERTIES = True diff --git a/lemoncurry/settings/dev.py b/lemoncurry/settings/dev.py index ef5e948..b5857fe 100644 --- a/lemoncurry/settings/dev.py +++ b/lemoncurry/settings/dev.py @@ -3,3 +3,5 @@ from .base import * ALLOWED_HOSTS = ['*'] STATIC_URL = 'https://static.00dani.dev/' MEDIA_URL = STATIC_URL + 'media/' +META_SITE_DOMAIN = '00dani.dev' +META_FB_APPID = '142105433189339' diff --git a/lemoncurry/settings/prod.py b/lemoncurry/settings/prod.py index 18614fb..65d1b62 100644 --- a/lemoncurry/settings/prod.py +++ b/lemoncurry/settings/prod.py @@ -16,3 +16,5 @@ DATABASES['default'] = { STATIC_URL = 'https://cdn.00dani.me/' MEDIA_URL = STATIC_URL + 'media/' +META_SITE_DOMAIN = '00dani.me' +META_FB_APPID = '145311792869199' diff --git a/lemoncurry/templates/lemoncurry/layout.html b/lemoncurry/templates/lemoncurry/layout.html index 9bff574..91aab5b 100644 --- a/lemoncurry/templates/lemoncurry/layout.html +++ b/lemoncurry/templates/lemoncurry/layout.html @@ -1,9 +1,10 @@ -{% load compress favtags lemoncurry_tags static %} +{% load compress favtags lemoncurry_tags meta static %} - + {% site_name %} + {% include 'meta/meta.html' %} {% placeFavicon %}