Advertisement
Igor150195

микроразметка

Jun 22nd, 2021
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.99 KB | None | 0 0
  1. Микроразметка
  2. включить спецпеременную "gr_schema_org": true,
  3. json взять из 130 "Микроразметка Open Graph" и "Микроразметка schema.org" http://prntscr.com/166165s
  4.  
  5. html:
  6. в head добавить
  7. {if $site.additional_work.open_graph}
  8. {assign var=meta_logo_width value=$site.header_block.logo_width|strip_tags|regex_replace:"/[^\d]/":""|default:90}
  9. {assign var=meta_logo_height value="-"}
  10. {if $mode == 'main'}
  11. <meta property="og:image" content="{$smarty.server.PROTOCOL}://{$smarty.server.HTTP_HOST}{s3_img width=$meta_logo_width height=$meta_logo_height method=c src=$site.header_block.site_logo.filename}"/>
  12. <meta property="og:type" content="website" />
  13. <meta property="og:title" content="{$page.title|strip_tags}"/>
  14. <meta property="og:description" content="{$page.description|escape}"/>
  15. <meta property="og:url" content="{$smarty.server.PROTOCOL}://{$smarty.server.HTTP_HOST}{$smarty.server.SCRIPT_URL}"/>
  16. {elseif $mode == "product"}
  17. <meta property="og:image" content="{s3_img src=$product.image_filename}"/>
  18. <meta property="og:type" content="website" />
  19. <meta property="og:title" content="{$product.name|default:$h1|default:$page.name}"/>
  20. <meta property="og:description" content="{$page.description|escape}"/>
  21. <meta property="og:url" content="{$smarty.server.PROTOCOL}://{$smarty.server.HTTP_HOST}{$smarty.server.SCRIPT_URL}"/>
  22. {elseif $mode == 'folder'}
  23. <meta property="og:image" content="{$smarty.server.PROTOCOL}://{$smarty.server.HTTP_HOST}{s3_img width=$meta_logo_width height=$meta_logo_height method=c src=$site.header_block.site_logo.filename}"/>
  24. <meta property="og:type" content="website" />
  25. <meta property="og:title" content="{$folder.folder_name}"/>
  26. <meta property="og:description" content="{$page.description|escape}"/>
  27. <meta property="og:url" content="{$smarty.server.PROTOCOL}://{$smarty.server.HTTP_HOST}{$smarty.server.SCRIPT_URL}"/>
  28. {else}
  29. <meta property="og:image" content="{$smarty.server.PROTOCOL}://{$smarty.server.HTTP_HOST}{s3_img width=$meta_logo_width height=$meta_logo_height method=c src=$site.header_block.site_logo.filename}"/>
  30. <meta property="og:type" content="website" />
  31. <meta property="og:title" content="{$h1|default:$page.h1|default:$page.name}"/>
  32. <meta property="og:description" content="{$page.description|escape}"/>
  33. <meta property="og:url" content="{$smarty.server.PROTOCOL}://{$smarty.server.HTTP_HOST}{$smarty.server.SCRIPT_URL}"/>
  34. {/if}
  35. {/if}
  36. http://prntscr.com/16bk86g тут, если отличается json логотипа - напишите свою
  37.  
  38. В bottom.tpl (главная низ) - добавить код http://prntscr.com/16bkozx
  39. {if $site.additional_work.schema_org}
  40. <div class="hide">
  41. <div class="search" itemscope itemtype="https://schema.org/WebSite">
  42. <meta itemprop="url" content="{$smarty.server.PROTOCOL}://{$smarty.server.HTTP_HOST}"/>
  43. <form itemprop="potentialAction" itemscope itemtype="https://schema.org/SearchAction">
  44. <meta itemprop="target" content="{$smarty.server.PROTOCOL}://{$smarty.server.HTTP_HOST}{get_seo_url uri_prefix=$shop2.uri mode='search'}?search_text={ldelim}search_term_string{rdelim}"/>
  45. <input itemprop="query-input" type="text" id="search_string_query" name="search_term_string" required/>
  46. <input type="submit"/>
  47. </form >
  48. </div>
  49. </div>
  50. {/if}
  51.  
  52. И в использовать хлебные крошки 130 шаблона добавив проверку на микроразметку - http://prntscr.com/16bkw2y
  53.  
  54. {if $site.additional_work.schema_org}
  55. {include file="global:pagepath-2.2.130.tpl" schema_org=true path_separator="<span class='site-path__separator'>/</span>" class="site-path"}
  56. {else}
  57. {include file="global:pagepath-2.2.130.tpl" path_separator="<span class='site-path__separator'>/</span>" class="site-path"}
  58. {/if}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement