kunstmaan/seo-bundle
Composer 安装命令:
composer require kunstmaan/seo-bundle
包简介
Annotating content with metadata for social sharing and seo purposes cannot be overlooked nowadays. The KunstmaanSeoBundle contains default editing functionality for OpenGraph data, meta descriptions, keywords and titles and Metriweb tags. Because the metatagging and tracking options are always chan
关键字:
README 文档
README
Annotating content with metadata for social sharing and seo purposes cannot be overlooked nowadays. The KunstmaanSeoBundle contains default editing functionality for OpenGraph data, meta descriptions, keywords and titles and Metriweb tags. Because the metatagging and tracking options are always changing, a free field to add custom header information is provided as well.
View more screenshots and information https://cms.kunstmaan.be.
Installation
This bundle is compatible with all Symfony 3.* releases. More information about installing can be found in this line by line walkthrough of installing Symfony and all our bundles, please refer to the Getting Started guide and enjoy the full blown experience.
Symfony 2.2
If you want to use this bundle for a Symfony 2.2 release, use the 2.2 branch.
Usage
Metadata
In your template define the following to import all SEO metadata. This SEO metadata is set in the SEO tab for your page in the backend.
{% if page is defined %}
{{ render_seo_metadata_for(page) }}
{% endif %}
For the title there are several options. There are several twig functions which return a title based on which is found first. If they are all null or empty it'll return an empty string.
The get_title_for twig function used the following order:
- SEO title
- Page title If nothing is set it'll return an empty string.
Another option is get_title_for_page_or_default. This twig function accepts a default string that is used as a fallback.
- SEO title
- default string
- Page title
You can also access the raw SEO object through the get_seo_for function.
Social Widgets
And finally the SEO bundle is also capable of generating 'social widgets' such as a facebook like button. For now only facebook like & linkedin product are supported.
Use the get_social_widget_for function. Example: get_social_widget_for(page, 'linkedin').
You can override the views for all the functions that generate HTML output.
Google Analytics
Added to the SEO bundle are a few helpers to control Google Analytics.
These helpers rely on the inclusion of the analytics.js file that's provided in this bundle. The script itself relies on jQuery to be present.
{% javascripts
'vendor/jquery/jquery.js'
'@KunstmaanSeoBundle/Resources/public/js/analytics.js'
output='frontend/footer.js'
%}
<script src='{{ asset_url }}'></script>
{% endjavascripts %}
First up is google_analytics_initialize which looks for the Google Analytics Account ID in your config.
parameters: google.analytics.account_id: 'UA-XXXXX-1'
You can also optionally pass the account_id as an argument to the function.
{{ google_analytics_initialize({'account_id': 'UA-XXXXX-1'}) }}
This script will set up a queue with commands (_gaq) and the Google Analytics script itself (_ga). When Twig is in debug mode it'll not initialize the script but instead it'll just dump all requests to the console. This way you can easily monitor what Google Analytics is planning on doing in your production environment.
The script will automatically track downloads, external links, links to email addresses & button clicks.
Finally, we've also provided a JavaScript function which you'll have to call manually once the Twitter/Facebook SDK's have been loaded. This will then bind a callback via the SDKs which will log the events.
googleAnalyticsApi.trackSocial('optional pageurl', 'optional trackername')
We've also added a helper for e-commerce tracking. You have to set up an Order object with its OrderItems
and pass it along to the google_analytics_track_order twig function. This will output the correctly formatted syntax for Google Analytics.
public function service(ContainerInterface $container, Request $request, RenderContext $renderContext) { $order = (new Order()) ->setShippingTotal(5) ->setTransactionID('ORD2013-00231'); $order->orderItems[] = (new OrderItem()) ->setName('ACME 3000 Starter Kit') ->setQuantity(20) ->setUnitPrice(13.5) ->setTaxes((20 * 13.5) * 0.21) ->setCategoryorVariation('World Domination') ->setSKU('ACM300-SK'); $order->orderItems[] = (new OrderItem()) ->setName('Super Duper Kit') ->setQuantity(1) ->setUnitPrice(3000) ->setTaxes((3000) * 0.21) ->setCategoryorVariation('Fun') ->setSKU('SDK-3000'); $renderContext['order'] = $order; }
{{ google_analytics_track_order(order) }}
kunstmaan/seo-bundle 适用场景与选型建议
kunstmaan/seo-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 131.85k 次下载、GitHub Stars 达 24, 最近一次更新时间为 2012 年 10 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cms」 「seo」 「kunstmaan」 「opengraph」 「meta」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 kunstmaan/seo-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kunstmaan/seo-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 kunstmaan/seo-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Extends the MinkContext and adds some additional (sub)contexts like creating a screenshot when a step fails or wait for Ajax to finish before continuing assertPageContainsText()
The KunstmaanLiveReloadBundle injects the livereload script from grunt-contrib-watch into your html page.
GraphQL authentication for your headless Craft CMS applications.
Set Links with a specific language parameter
Supercharged text field validation.
Enable indexing Kunstmaan Bundles CMS pages in Algolia
统计信息
- 总下载量: 131.85k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 28
- 点击次数: 27
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-10-22