定制 nepttune/sitemap 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nepttune/sitemap

最新稳定版本:v2.0.1

Composer 安装命令:

composer require nepttune/sitemap

包简介

Component for Nette framework which renders as xml sitemap.

README 文档

README

🔧 Sitemap generator component

Introduction

This componenet automaticaly generates sitemap from annotated presenter actions. Found actions are cached to improve performance.

Installation

Install package using composer

composer require nepttune/sitemap

Dependencies

How to use

  • Implement \Nepttune\TI\ISitemap interface and use \Nepttune\TI\TSitemap trait in selected presenters (Those which should have links in sitemap.).
  • Add annotation @sitemap to selected actions.
  • Register \Nepttune\Component\ISitemapFactory as service in cofiguration file.
  • Inject it into eg. SitemapPresenter, write createComponent method and use macro {control} in template file.
    • Just as any other component.
    • Content type is automaticaly set to application/xml.

Example configuration

services:
    - Nepttune\Component\ISitemapFactory

You can optionaly provide configuration array and enable hreflang links to be included for each entry (Requires translator in presenter).

parameters:
    sitemap:
        hreflang: true
        
services:
    sitemapFactory:
            implement: Nepttune\Component\ISitemapFactory
            arguments:
                - '%sitemap%'

Example presenter

class ExamplePresenter implements IPresenter, ISitemap
{
    use TSitemap;

    /** @var  \Nepttune\Component\ISitemapFactory */
    protected $iSitemapFactory;
    
    public function __construct(\Nepttune\Component\ISitemapFactory $ISitemapFactory)
    {
        $this->iSitemapFactory = $ISitemapFactory;
    }
    
    public function actionSitemap()
    {
        $this->getHttpResponse()->setContentType('application/xml');
    }
    
    /**
     * @sitemap
     */
    public function actionExample()
    {
    }

    protected function createComponentSitemap()
    {
        return $this->iSitemapFactory->create();
    }
}

统计信息

  • 总下载量: 5.57k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-04-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固