Close

Ссылки в Sitemap

Ув. Форумчане помогите пожалуйста, проблема в том что ссылки(<loc></loc>) в Sitemap на http а сайт на https, что в коде нужно изменить? Спасибо.

Код:

/**
 * Sitemap
 */
Route::get('sitemap.xml', function() {
    $sitemap  = '<?xml version="1.0" encoding="UTF-8"?>';
    $sitemap .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';

    // Pages
    $query = Page::where('status', '=', 'published');
    foreach($query->get() as $page) {
        $sitemap .= '<url>';
        $sitemap .= '<loc>' . full_url() . $page->slug . '</loc>';
        $sitemap .= '<changefreq>weekly</changefreq>';
        $sitemap .= '</url>';
    }

    // Posts
    $query = Post::where('status', '=', 'published')->sort(Base::table('posts.created'), 'desc');
    foreach($query->get() as $article) {
        $sitemap .= '<url>';
        $sitemap .= '<loc>' . Uri::full(Registry::get('posts_page')->slug . '/' . $article->slug) . '</loc>';
        $sitemap .= '<lastmod>' . date("Y-m-d", strtotime($article->created)) . '</lastmod>';
        $sitemap .= '</url>';
    }

    $sitemap .= '</urlset>';

    return Response::create($sitemap, 200, array('content-type' => 'application/xml'));
});


Источник

Добавить комментарий