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
// 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
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
\r
public function getSEOContent()\r
{\r
+\r
+\r
$res = '';\r
if (null !== $this->h1) {\r
$res .= '<h1>' . htmlentities($this->h1) . '</h1>';\r