public static function postsTags()
    {
        if (!getConfig('sitemap.posts_tags')) {
            return [];
        }

        $table = TableRegistry::get('MeCms.Tags');
        $url = Cache::read('sitemap', $table->getCacheName());

        if (!$url) {
            $tags = $table->find('active')
                ->select(['tag', 'modified'])
                ->order(['tag' => 'ASC']);

            if ($tags->isEmpty()) {
                return [];
            }

            $latest = $table->find()
                ->select(['modified'])
                ->order(['modified' => 'DESC'])
                ->firstOrFail();

            //Adds the tags index
            $url[] = self::parse(['_name' => 'postsTags'], ['lastmod' => $latest->modified]);

            //Adds each tag
            foreach ($tags as $tag) {
                $url[] = self::parse(['_name' => 'postsTag', $tag->slug], ['lastmod' => $tag->modified]);
            }

            Cache::write('sitemap', $url, $table->getCacheName());
        }

        return $url;
    }
public static function postsTags()
    {
        if (!getConfig('sitemap.posts_tags')) {
            return [];
        }

        $table = TableRegistry::get('MeCms.Tags');
        $url = Cache::read('sitemap', $table->getCacheName());

        if (!$url) {
            $tags = $table->find('active')
                ->select(['tag', 'modified'])
                ->order(['tag' => 'ASC']);

            if ($tags->isEmpty()) {
                return [];
            }

            $latest = $table->find()
                ->select(['modified'])
                ->order(['modified' => 'DESC'])
                ->firstOrFail();

            //Adds the tags index
            $url[] = self::parse(['_name' => 'postsTags'], ['lastmod' => $latest->modified]);

            //Adds each tag
            foreach ($tags as $tag) {
                $url[] = self::parse(['_name' => 'postsTag', $tag->slug], ['lastmod' => $tag->modified]);
            }

            Cache::write('sitemap', $url, $table->getCacheName());
        }

        return $url;
    }
public static function postsTags ( ) { if ( ! getConfig ( 'sitemap.posts_tags' ) ) { return [ ] ; } $ table = TableRegistry :: get ( 'MeCms.Tags' ) ; $ url = Cache :: read ( 'sitemap' , $ table -> getCacheName ( ) ) ; if ( ! $ url ) { $ tags = $ table -> find ( 'active' ) -> select ( [ 'tag' , 'modified' ] ) -> order ( [ 'tag' => 'ASC' ] ) ; if ( $ tags -> isEmpty ( ) ) { return [ ] ; } $ latest = $ table -> find ( ) -> select ( [ 'modified' ] ) -> order ( [ 'modified' => 'DESC' ] ) -> firstOrFail ( ) ; //Adds the tags index $ url [ ] = self :: parse ( [ '_name' => 'postsTags' ] , [ 'lastmod' => $ latest -> modified ] ) ; //Adds each tag foreach ( $ tags as $ tag ) { $ url [ ] = self :: parse ( [ '_name' => 'postsTag' , $ tag -> slug ] , [ 'lastmod' => $ tag -> modified ] ) ; } Cache :: write ( 'sitemap' , $ url , $ table -> getCacheName ( ) ) ; } return $ url ; }
Returns posts tags urls
@return array
@uses MeCms\Utility\SitemapBuilder::parse()
Returns posts tags urls