Last active
January 20, 2016 14:16
-
-
Save torunar/84b6c943e0154880550e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/addons/seo/controllers/frontend/index.post.php b/app/addons/seo/controllers/frontend/index.post.php | |
new file mode 100644 | |
index 0000000..8d6b3d6 | |
--- /dev/null | |
+++ b/app/addons/seo/controllers/frontend/index.post.php | |
@@ -0,0 +1,22 @@ | |
+<?php | |
+/*************************************************************************** | |
+ * * | |
+ * (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev * | |
+ * * | |
+ * This is commercial software, only users who have purchased a valid * | |
+ * license and accept to the terms of the License Agreement can install * | |
+ * and use this program. * | |
+ * * | |
+ **************************************************************************** | |
+ * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE * | |
+ * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. * | |
+ ****************************************************************************/ | |
+ | |
+if (!defined('BOOTSTRAP')) { die('Access denied'); } | |
+ | |
+if ($mode == 'index') { | |
+ | |
+ Tygh::$app['view']->assign('seo_canonical', array( | |
+ 'current' => fn_url('') | |
+ )); | |
+} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/functions/smarty_plugins/block.scripts.php b/app/functions/smarty_plugins/block.scripts.php | |
index 5c1d771..7cbd9fd 100644 | |
--- a/app/functions/smarty_plugins/block.scripts.php | |
+++ b/app/functions/smarty_plugins/block.scripts.php | |
@@ -85,9 +85,14 @@ function smarty_block_scripts($params, $content, &$smarty, &$repeat) | |
} | |
} | |
- foreach ($m[2] as $sc) { | |
+ foreach ($m[2] as $id => $sc) { | |
if (!empty($sc)) { | |
- $return .= '<script type="text/javascript">' . $sc . '</script>' . "\n"; | |
+ $script_type = 'text/javascript'; | |
+ // allow script types besides text/javascript | |
+ if (preg_match_all('/type="(.+?)"/', $m[1][$id], $type_matches)) { | |
+ $script_type = $type_matches[1][0]; | |
+ } | |
+ $return .= '<script type="'.$script_type.'">' . $sc . '</script>' . "\n"; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/design/themes/responsive/templates/addons/seo/hooks/index/scripts.post.tpl b/design/themes/responsive/templates/addons/seo/hooks/index/scripts.post.tpl | |
new file mode 100644 | |
index 0000000..5fae265 | |
--- /dev/null | |
+++ b/design/themes/responsive/templates/addons/seo/hooks/index/scripts.post.tpl | |
@@ -0,0 +1,14 @@ | |
+{$search_url = fn_url('products.search?search_performed=Y&q=')} | |
+{$site_url = fn_url("")} | |
+<script type="application/ld+json"> | |
+{ | |
+ "@context": "http://schema.org", | |
+ "@type": "WebSite", | |
+ "url": "{$site_url nofilter}", | |
+ "potentialAction": { | |
+ "@type": "SearchAction", | |
+ "target": "{$search_url nofilter}{ldelim}search_term{rdelim}", | |
+ "query-input": "required name=search_term" | |
+ } | |
+} | |
+</script> | |
\ No newline at end of file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment