[silvatheme.renaissance][Emiliano D'Alterio] Added a new main te...

[email protected] Fri, 18 Oct 2013 19:23:42 +0200
Newsgroups gmane.comp.web.zope.silva.cvs
Message-ID <[email protected]>
author:    Emiliano D'Alterio
date:      Fri Oct 18 19:23:24 2013 +0200
revision:  365:df3f79d8c6b6 in silvatheme.renaissance
branch:    2.4
details:   https://hg.infrae.com/silvatheme.renaissance?cmd=changeset;node=df3f79d8c6b6
modified:  src/silvatheme/renaissance/renaissance.py src/silvatheme/renaissance/renaissance_templates/headinsert.cpt src/silvatheme/renaissance/renaissance_templates/htmlheadbody.cpt
added:     src/silvatheme/renaissance/renaissance_templates/htmlheadbody.cpt
removed:   src/silvatheme/renaissance/renaissance_templates/headinsert.cpt
log:       Added a new main template. Removed favicon and headinsert viewlets.
	Added a viewlet manager. Fixed Twitter card invalid html.


diffstat:

 src/silvatheme/renaissance/renaissance.py                         |  13 +-
 src/silvatheme/renaissance/renaissance_templates/headinsert.cpt   |  34 ----
 src/silvatheme/renaissance/renaissance_templates/htmlheadbody.cpt |  75 ++++++++++
 3 files changed, 80 insertions(+), 42 deletions(-)

diffs (157 lines):

diff -r 2c3255e3a6b4 -r df3f79d8c6b6 src/silvatheme/renaissance/renaissance.py
--- a/src/silvatheme/renaissance/renaissance.py	Wed Oct 16 13:35:04 2013 +0200
+++ b/src/silvatheme/renaissance/renaissance.py	Fri Oct 18 19:23:24 2013 +0200
@@ -55,6 +55,7 @@
 
 
 class MainLayout(porto.MainLayout):
+    grok.template('htmlheadbody')
 
     @Lazy
     def filter_contents(self):
@@ -275,16 +276,16 @@
         return ''
 
 
-class HeadInsert(silvaviews.Viewlet):
-    """ Custom head insertions
+class HTMLHeadInsert(silvaviews.ViewletManager):
+    """Extra elements to be inserted in the HTML Head.
     """
-    grok.viewletmanager(porto.HTMLHeadInsert)
+    pass
 
 
 class HeadInsertFeeds(silvaviews.Viewlet):
     """Rel link insertions when feeds are active
     """
-    grok.viewletmanager(porto.HTMLHeadInsert)
+    grok.viewletmanager(HTMLHeadInsert)
 
     def update(self):
         feed_provider = IFeedEntryProvider(self.context, None)
@@ -298,7 +299,3 @@
             else:
                 self.have_feeds = True
             self.feed_url = absoluteURL(self.context, self.request)
-
-
-class Favicon(porto.Favicon):
-    grok.template('favicon')
diff -r 2c3255e3a6b4 -r df3f79d8c6b6 src/silvatheme/renaissance/renaissance_templates/headinsert.cpt
--- a/src/silvatheme/renaissance/renaissance_templates/headinsert.cpt	Wed Oct 16 13:35:04 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-<tal:headinsert
-  tal:define="
-    siteurl layout.root_url;
-    metadata path:layout/metadata/silva-extra;
-    ">    <!-- Custom head elements -->
-    <meta name="robots" content="index, follow" />
-    <meta name="revisit-after" content="10 days" />
-    <meta name="twitter:card" value="summary" />
-    <meta name="twitter:domain" value="infrae.com" />
-    <meta name="twitter:site" value="@infrae" />
-    <meta name="twitter:url" tal:attributes="content path:context/@@absolute_url" />
-    <meta name="twitter:title" tal:attributes="content path:context/get_title" />
-    <meta name="twitter:description"
-      tal:define="description metadata.subject | None"
-      tal:condition="description"
-      tal:attributes="content description" />
-    <meta name="twitter:image:src" content="http://infrae.com/images/infrae_logo120w.png" />
-    <meta property="og:url" tal:attributes="content path:context/@@absolute_url" />
-    <meta property="og:site_name" content="infrae.com" />
-    <meta property="og:type" content="website" />
-    <meta property="og:title" tal:attributes="content path:context/get_title" />
-    <meta property="og:description"
-      tal:define="description metadata.content_description | None"
-      tal:condition="description"
-      tal:attributes="content description" />
-    <meta property="og:image" content="http://infrae.com/images/infrae_logo120w.png" />
-    <!-- Related links -->
-    <link rel="canonical" tal:attributes="href path:context/@@absolute_url" />
-    <link rel="apple-touch-icon" href="/mobicon.png"
-      tal:attributes="href path:static/img/mobicon.png" />
-    <link rel="copyright" title="Copyright"
-      tal:attributes="href string:${siteurl}/copyright" />
-    <link rel="alternate" type="application/x-wiki" href="./edit" title="Edit this page (login required)" />
-</tal:headinsert>
diff -r 2c3255e3a6b4 -r df3f79d8c6b6 src/silvatheme/renaissance/renaissance_templates/htmlheadbody.cpt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/silvatheme/renaissance/renaissance_templates/htmlheadbody.cpt	Fri Oct 18 19:23:24 2013 +0200
@@ -0,0 +1,75 @@
+<tal:DOCTYPE tal:replace="structure layout.doctype" />
+<html tal:define="
+  siteurl layout.root_url;
+  metadata path:layout/metadata/silva-extra;
+  lang metadata.language"
+  tal:attributes="lang python:lang or None">
+<head>
+<title tal:content="layout.title">Title</title>
+<base tal:attributes="href path:context/@@absolute_url" />
+<meta charset="UTF-8" />
+<meta name="generator" content="Silva" />
+<meta name="subject"
+  tal:define="subject metadata.subject | None"
+  tal:condition="subject"
+  tal:attributes="content subject" />
+<meta name="keywords"
+  tal:define="keywords metadata.keywords | None"
+  tal:condition="keywords"
+  tal:attributes="content keywords" />
+<meta name="description"
+  tal:define="description metadata.content_description | None"
+  tal:condition="description"
+  tal:attributes="content description" />
+<link rel="schema.dcterms" href="http://purl.org/dc/terms/" />
+<meta name="dcterms.subject"
+  tal:define="subject metadata.subject | None"
+  tal:condition="subject"
+  tal:attributes="content subject" />
+<meta name="dcterms.abstract"
+  tal:define="description metadata.content_description | None"
+  tal:condition="description"
+  tal:attributes="content description" />
+<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
+<meta property="twitter:card" content="summary" />
+<meta property="twitter:domain" content="infrae.com" />
+<meta property="twitter:site" content="@infrae" />
+<meta property="twitter:url" tal:attributes="content path:context/@@absolute_url" />
+<meta property="twitter:title" tal:attributes="content path:context/get_title" />
+<meta property="twitter:description"
+  tal:define="description metadata.subject | None"
+  tal:condition="description"
+  tal:attributes="content description" />
+<meta property="twitter:image:src" content="http://infrae.com/images/infrae_logo120w.png" />
+<meta property="og:url" tal:attributes="content path:context/@@absolute_url" />
+<meta property="og:site_name" content="infrae.com" />
+<meta property="og:type" content="website" />
+<meta property="og:title" tal:attributes="content path:context/get_title" />
+<meta property="og:description"
+  tal:define="description metadata.content_description | None"
+  tal:condition="description"
+  tal:attributes="content description" />
+<meta property="og:image" content="http://infrae.com/images/infrae_logo120w.png" />
+<meta name="geo.region" content="NL-ZH" />
+<meta name="geo.placename" content="Rotterdam" />
+<meta name="geo.position" content="51.927423;4.466578" />
+<meta name="ICBM" content="51.927423, 4.466578" />
+<meta name="robots" content="index, follow" />
+<meta name="revisit-after" content="10 days" />
+<tal:resource tal:replace="structure provider:resources" />
+<link rel="canonical" tal:attributes="href path:context/@@absolute_url" />
+<link rel="apple-touch-icon" href="/mobicon.png"
+  tal:attributes="href path:static/img/mobicon.png" />
+<link rel="copyright" title="Copyright"
+  tal:attributes="href string:${siteurl}/copyright" />
+<link rel="alternate" type="application/x-wiki" href="./edit" title="Edit this page (login required)" />
+<tal:extraelements tal:replace="structure provider:htmlheadinsert" />
+<link rel="shortcut icon" href="#"
+  tal:attributes="href path:static/img/favicon.ico" />
+<!-- Injector for on-the-fly inclusion -->
+<link tal:replace="structure path:context/head_inject | None" />
+</head>
+<body tal:attributes="class layout.body_id">
+<tal:layout tal:replace="structure provider:layout" />
+</body>
+</html>