From 0527e33e8733d5fe92a2f732f9529269cc5aba9a Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 20 Mar 2017 17:49:35 +0100 Subject: OpenGraph: no empty description - image width and image height --- chimere/templates/base.html | 17 +++++++++++++++++ chimere/views.py | 4 ++++ settings.py | 5 ++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/chimere/templates/base.html b/chimere/templates/base.html index 286ae88..4e87e44 100644 --- a/chimere/templates/base.html +++ b/chimere/templates/base.html @@ -14,16 +14,33 @@ {% if current_feature.image %} + + {% elif PROJECT_IMAGE %} + + {% endif %} + {% if current_feature.text_description %} {% else %} + + {% endif %} + {% else %} {% if PROJECT_IMAGE %} + + {% endif %} + {% endif %} {% endblock %} diff --git a/chimere/views.py b/chimere/views.py index f2bc5fc..919824a 100644 --- a/chimere/views.py +++ b/chimere/views.py @@ -213,6 +213,10 @@ def index(request, area_name=None, default_area=None, simple=False, }) if hasattr(settings, 'PROJECT_IMAGE') and settings.PROJECT_IMAGE: response_dct['PROJECT_IMAGE'] = settings.PROJECT_IMAGE + if hasattr(settings, 'PROJECT_IMAGE_WIDTH'): + response_dct['PROJECT_IMAGE_WIDTH'] = settings.PROJECT_IMAGE_WIDTH + if hasattr(settings, 'PROJECT_IMAGE_HEIGHT'): + response_dct['PROJECT_IMAGE_HEIGHT'] = settings.PROJECT_IMAGE_HEIGHT if hasattr(settings, 'CONTACT_EMAIL') and settings.CONTACT_EMAIL: response_dct['contact_email'] = settings.CONTACT_EMAIL response_dct['share_networks'], net_dct = \ diff --git a/settings.py b/settings.py index 0ab3a23..ec67e5a 100644 --- a/settings.py +++ b/settings.py @@ -13,12 +13,15 @@ MOBILE_TEST = False DEBUG_TOOLBAR = False SQL_DEBUG = False +ROOT_PATH = os.path.realpath(os.path.dirname(__file__)) + "/" # Django settings for chimere project. PROJECT_NAME = 'Chimere' # url of the project image PROJECT_IMAGE = '' -ROOT_PATH = os.path.realpath(os.path.dirname(__file__)) + "/" +# mandatory if you put an image +PROJECT_IMAGE_WIDTH = 0 +PROJECT_IMAGE_HEIGHT = 0 EMAIL_HOST = 'localhost' CONTACT_EMAIL = '' -- cgit v1.2.3