]> _ Git - cubeextranet.git/commitdiff
fix #2154 @0.25
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 24 Jul 2018 10:07:51 +0000 (10:07 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 24 Jul 2018 10:07:51 +0000 (10:07 +0000)
inc/ws/Util/html5/master/class.ws.html5.seo.php

index 4890796db19ece8822999b1229b63707763916c9..56e60160b8721a7ad2509300327e50fba477df8b 100644 (file)
@@ -19,7 +19,7 @@ class wsHTML5Seo
                foreach ($compiler->pages as $page => $infos) {\r
                        $p = new wsHTML5SeoPage($this);\r
                        $p->page = $page;\r
-                       $p->title = $this->_getPageLabel($page);\r
+                       $p->title = ($page == 1) ? $this->compiler->book->parametres->title : $this->_getPageLabel($page);\r
                        $p->text = $this->getTextContent($infos);\r
                        $p->description = $this->compiler->book->parametres->seoDescription ? $this->compiler->book->parametres->seoDescription : $this->compiler->book->parametres->title . ' - Powered by Fluidbook';\r
                        $p->keywords = $this->compiler->book->parametres->seoKeywords;\r
@@ -28,7 +28,12 @@ class wsHTML5Seo
                        // Google analytics\r
                        $p->ua = '';\r
                        if ($this->compiler->book->parametres->googleAnalytics != '') {\r
-                               $p->ua .= cubePage::googleAnalytics($this->compiler->book->parametres->googleAnalytics);\r
+                               $codes = explode(',', $this->compiler->book->parametres->googleAnalytics);\r
+                               $p->ua .= "<script async src=\"https://www.googletagmanager.com/gtag/js?id=" . $codes[0] . "\"></script>\n\t<script>\n\t\twindow.dataLayer = window.dataLayer || [];\n\t\tfunction gtag(){dataLayer.push(arguments);}\n\t\tgtag('js', new Date());\n\t";\r
+                               foreach ($codes as $code) {\r
+                                       $p->ua .= "\tgtag('config', '" . $code . "');\n\t";\r
+                               }\r
+                               $p->ua .= "</script>";\r
                        }\r
                        if ($this->compiler->book->parametres->googleAnalyticsCustom != '') {\r
                                $p->ua .= $this->compiler->book->parametres->googleAnalyticsCustom;\r
@@ -80,7 +85,10 @@ class wsHTML5Seo
                                break;\r
                }\r
 \r
-               return file_get_contents(wsDocument::getDir($infos['document_id']) . $prefix . 'h' . $infos['document_page'] . '.txt');\r
+               $res = trim(file_get_contents(wsDocument::getDir($infos['document_id']) . $prefix . 'h' . $infos['document_page'] . '.txt'));\r
+               $res = preg_replace('|\<\/div\>$|', '', $res);\r
+\r
+               return $res;\r
        }\r
 \r
        public function _getPageLabel($page)\r
@@ -163,6 +171,8 @@ class wsHTML5SeoPage
 \r
        public function getSEOContent()\r
        {\r
+\r
+\r
                $res = '';\r
                if (null !== $this->h1) {\r
                        $res .= '<h1>' . htmlentities($this->h1) . '</h1>';\r