LaravelPackages.net
Acme Inc.
Toggle sidebar
cviebrock/laravel-news-sitemap

A simple Google News Sitemap generator for Laravel.

4.910
5
0.9.1
About cviebrock/laravel-news-sitemap

cviebrock/laravel-news-sitemap is a Laravel package for a simple google news sitemap generator for laravel.. It currently has 5 GitHub stars and 4.910 downloads on Packagist (latest version 0.9.1). Install it with composer require cviebrock/laravel-news-sitemap. Discover more Laravel packages by cviebrock or browse all Laravel packages to compare alternatives.

Last updated

laravel-news-sitemap

A Google News sitemap generator for Laravel 4.

Build Status Total Downloads Latest Stable Version

Installation

Add the package to your composer.json file:

'cviebrock/laravel-news-sitemap' => 'dev-master'

Add the service provider to app/config/app.php

'providers' => array(
    ...
    'Cviebrock\LaravelNewsSitemap\ServiceProvider',
);

Publish the configuration file:

php artisan config:publish cviebrock/laravel-news-sitemap

Sample Usage

// create a new sitemap instance
$sitemap = \App::make('Cviebrock\LaravelNewsSitemap\NewsSitemap');

// if it's not cached, then populate with entries
if (!$sitemap->isCached()) {

    foreach (Posts::all() as $post) {

		$extras = [];
		$images = [];

		foreach ($post->images as $image) {
			$images[] = [
			    'loc' => $image->url,
			    'caption' => $image->caption
            ];
		}

		$extras['keywords'] = $post->topics->lists('name');

		$this->sitemap->addEntry($post->url, $post->title, $post->published_at, $extras, $images);
	}

}

// returns an XML response
return $sitemap->render();

Bugs, Suggestions and Contributions

Please use Github for bugs, comments, suggestions.

  1. Fork the project.
  2. Create your bugfix/feature branch and write your (well-commented) code.
  3. Commit your changes and push to your repository.
  4. Create a new pull request against this project's master branch.

laravel-news-sitemap was written by Colin Viebrock and released under the MIT License. See the LICENSE file for details.

Copyright 2014 Colin Viebrock

Comments
Affiliate link

Get paid by clients abroad

Wise gives you local bank details in several currencies and converts at the mid-market rate. Useful when your invoices are not in your own currency.

Try Wise

Star History Chart

Get the next ones by email

New Laravel packages worth a look, once a month. No spam, one-click unsubscribe.