Skip to content

Commit

Permalink
#25
Browse files Browse the repository at this point in the history
  • Loading branch information
cbertelegni committed Mar 14, 2017
1 parent 1fbf1ea commit 76b7bfc
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 13 deletions.
5 changes: 5 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ def index():
def share(slug):
featured_book = None
context = make_context()


context['dateModified'] = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
context['now'] = datetime.now().strftime("%d.%m.%Y")

with open('www/static-data/books.json', 'rb') as f:
books = json.load(f)
for book in books:
Expand Down
5 changes: 3 additions & 2 deletions app_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import os
import logging
import local_settings
from authomatic.providers import oauth2
from authomatic import Authomatic

Expand All @@ -20,7 +21,7 @@
"""
# Project name to be used in urls
# Use dashes, not underscores!
PROJECT_SLUG = 'books2016'
PROJECT_SLUG = 'books16'

# Allow override from local settings to test random_prod locally
try:
Expand Down Expand Up @@ -237,7 +238,7 @@ def configure_targets(deployment_target):

if deployment_target == 'production':
S3_BUCKET = PRODUCTION_S3_BUCKET
S3_BASE_URL = 'https://%s/%s' % (S3_BUCKET, PROJECT_SLUG)
S3_BASE_URL = 'http://%s/%s' % (S3_BUCKET, PROJECT_SLUG)
S3_DEPLOY_URL = 's3://%s/%s' % (S3_BUCKET, PROJECT_SLUG)
SERVERS = PRODUCTION_SERVERS
SERVER_BASE_URL = '//%s/%s' % (SERVERS[0], PROJECT_SLUG)
Expand Down
2 changes: 1 addition & 1 deletion less/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@headings-line-height: 1.1;

//color palette
@logo_LN: #0084b5;
@logo_LN: #006699;

@primary-control: #6d8ac4;
@deep-blue: #7598c9;
Expand Down
4 changes: 2 additions & 2 deletions local_settings.py.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import os
os.environ.get('DEPLOYMENT_TARGET', True)

os.environ["DEPLOYMENT_TARGET"] = "production"

COPY_GOOGLE_DOC_KEY = 'YOUR_COPY_GOOGLE_DOC_KEY'
#DATA_GOOGLE_DOC_KEY="YOUR_DATA_GOOGLE_DOC_KEY"
Expand All @@ -12,4 +13,3 @@ GOOGLE_OAUTH_CREDENTIALS_PATH = '~/.google_oauth_credentials'
# USE_ITUNES_ID = None
# LOG_LEVEL = logging.info

# print "**** GOO api client: %s" % (os.environ["GOOGLE_OAUTH_CLIENT_ID"])
92 changes: 84 additions & 8 deletions templates/share.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@
<head>
<title>Mejores libros : LN</title>

{% if not DEBUG %}
<script>
window.location = '{{ S3_BASE_URL }}/#/book/{{ book.slug }}';
</script>
{% endif %}

{# Twitter #}
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="{{ twitter_handle }}">
<meta name="twitter:site" content="{{ COPY.share.twitter_handle }}">
<meta name="twitter:image" content="{{ book.thumb }}" />

{# Facebook #}
<meta property="og:title" content="NPR's Best Books of 2016 - {{ book.title }}" />
<meta property="og:title" content="{{ COPY.content.header_title }} - {{ book.title }}" />
<meta property="og:url" content="{{ S3_BASE_URL }}/share/{{ book.slug }}.html" />
<meta property="og:type" content="article" />
<meta property="og:description" content="{{ book.teaser }}" />
Expand All @@ -27,14 +22,95 @@
{% endif %}


<meta property="og:site_name" content="NPR.org" />
<meta property="og:site_name" content="libros.lanacion.com.ar" />
<meta property="fb:app_id" content="{{ COPY.share.facebook_app_id }}" />

{# Google News #}
<meta name="thumbnail" content="{{ book.thumb }}" />



<!-- Google Analytics -->
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-621326-122', {'name':'especiales'});
ga('especiales.send', 'pageview');
ga('create', 'UA-621326-98', 'auto');
ga('send', 'pageview');
</script>
<!-- Google Analytics -->

<!-- Begin comScore Tag -->
<script>
var _comscore = _comscore || [];
_comscore.push({ c1: "2", c2: "6906398" });
(function () {
var s = document.createElement("script"), el = document.getElementsByTagName("script")[0]; s.async = true;
s.src = (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js";
el.parentNode.insertBefore(s, el);
})();
</script>
<noscript>
<img src="http://b.scorecardresearch.com/p?c1=2&c2=6906398&cv=2.0&cj=1" />
</noscript>
<!-- End comScore Tag -->

<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "NewsArticle",
"headline": "{{ COPY.content.header_title }}: {{ book.title }} - {{now}} - La Nación",
"url": "{{ S3_BASE_URL }}/share/{{ book.slug }}.html",
"thumbnailUrl": "{{ book.thumb }}",
"image": {
"@context": "http://schema.org",
"@type": "ImageObject",
"url": "{{ book.thumb }}"
{% if thumb_width and thumb_height%}
,
"height":{{ thumb_height }},
"width":{{ thumb_width }}
{% endif %}
},
"author": {
"@context": "http://schema.org",
"@type": "Person",
"name": "{AUTOR}"
},
"articleSection": "{{ COPY.content.header_title }}: {{ book.title }}",
"keywords": ["{{ COPY.content.header_title }}", "{{ book.title }}"],
"dateCreated": "2017-02-01 00:00:00",
"datePublished": "{{now}}",
"dateModified": "{{dateModified}}",
"publisher": {
"@type": "Organization",
"name": "LA NACION",
"url": "http://www.lanacion.com.ar/",
"logo": {
"@context": "http://schema.org",
"@type": "ImageObject",
"url": "http://static.lanacion.com.ar/v1/ln/imgs/layout/logos/logo-ln-amp.png",
"height":41,
"width":391
}
}
}
</script>

{% if not DEBUG %}
<script>
window.location = '{{ S3_BASE_URL }}/#/book/{{ book.slug }}';
</script>
{% endif %}
</head>

<body>

</body>

</html>
Expand Down

0 comments on commit 76b7bfc

Please sign in to comment.