proklung/ bitrixoggraphbundle
用于Bitrix + Symfony的OG标记管理包。
1.0.3
2021-05-14 05:32 UTC
Requires
- php: >=7.3
- astrotomic/php-open-graph: ^0.5.2
- spatie/data-transfer-object: ^2.5
- symfony/cache: ^4 || ^5
- symfony/config: ~4|~5
- symfony/dependency-injection: ^3.4 || ^4.0 || ^5.0
- symfony/http-kernel: ^4.0 || ^5.0
- symfony/string: ^4.0 || ^5.0
- webarchitect609/bitrix-cache: ^1.9
Requires (Dev)
README
配置
文件: local/configs/packages/bitrix_og_graph.yaml
设置默认OG标记。
<?php bitrixoggraph: enabled: true # Бандл активирован? site_name: 'EXAMPLE.RU' img: '/favicon.ico' fb_admins: '444003346913744' article_publisher: 'https://facebook/Example/' ?>
使用
用于组件(component_epilog.php)和静态页面的外观
通用
- 请求被缓存
- container() - 访问容器实例的助手。包含在Symfony-Bitrix的基础套件中。
详细页面
<?php container()->get('bitrix_og_graph_bundle.facade.element')->make( $arResult['IBLOCK_ID'], $arResult['ID'], ); ?>
- og:title 取自 ELEMENT_META_TITLE。
- og:description 取自 ELEMENT_META_DESCRIPTION。
- og:img 取自 PREVIEW_PICTURE。如果预览不存在,则从 DETAIL_PICTURE。
- og:timePublished 从 TIMESTAMP_X
- og:url 从 DETAIL_PAGE_URL
分发页面
<?php container()->get('bitrix_og_graph_bundle.facade.section')->make( $arResult['IBLOCK_ID'], $arResult['ID'], ); ?>
- og:title 取自 ELEMENT_META_TITLE。
- og:description 取自 ELEMENT_META_DESCRIPTION。
- og:img 取自 PICTURE。
- og:timePublished 从 TIMESTAMP_X
- og:url 从 SECTION_PAGE_URL
静态页面
<?php container()->get('bitrix_og_graph_bundle.facade.static')->make(); ?>
- og:title 取自页面标题属性。
- og:description 取自页面描述属性。
- og:img 取自页面og:image属性。
- og:timePublished 从index.php的最后修改时间
- og:url 从 SECTION_PAGE_URL