Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Matt Stauffer:
Adding an Auto-Generated Sitemap to Your Jigsaw-based Static Site
May 29, 2018 @ 16:07:42

If you're a user of the Jigsaw static site generation tool from Tighten, Matt Stauffer has a new post to his site that could come in handy. He shows how to automatically create a sitemap.

There are a few tasks that are still pretty tough with static sites—for example, search, and submitting forms (which we're trying to fix with FieldGoal). But there are other tasks that are tough-but-possible, and key among them are RSS and sitemaps. Let's start with sitemaps.

There was a feature recently added to help with this allowing you to add extra "hooks" to fire when the site builds. Matt makes use of this (and this package) to create a GenerateSitemap class that goes through each item in the site and adds a link to the sitemap.xml file. He shares the code for this class and the updates to make to the configuration and bootstrapping to correctly load the class.

tagged: generated sitemap jigsaw static site package tutorial

Link: https://mattstauffer.com/blog/adding-an-auto-generated-sitemap-to-your-jigsaw-based-static-site/

Laravel News:
Building a Search Engine Friendly Sitemap XML with Laravel
Sep 06, 2016 @ 15:51:05

On the Laravel News site today there's a post showing you how to create a basic sitemap for your Laravel-based application. This method uses straight up Laravel functionality (not the method previously mentioned in another post).

A few years ago search engines recommended submitted sitemaps to help with indexing your website and now the importance of this is debatable.

I’m of the mindset creating and submitting can’t hurt, so I spent a little time putting one together and wanted to share how easy this is in Laravel. [...] A sitemap is a file where you can list the web pages of your site to tell Google and other search engines about the organization of your site content. Search engine web crawlers like Googlebot read this file to more intelligently crawl your site. [...] On the official Sitemaps website it outlines all the information you will need for building your own sitemap.

He outlines some reasons why your site might need a sitemap before getting into examples and the code to create them. He starts with the controller and moves into making the index (with matching XML view) and the endpoints for the URLs referenced in the main sitemap. Finally a few routes are added for each endpoint and links to extending the contents and structure are included.

tagged: laravelnews laravel tutorial sitemap example xml

Link: https://laravel-news.com/2016/09/laravel-sitemap/

Freek Van der Herten:
Automatically generate a sitemap in Laravel
Sep 01, 2016 @ 15:51:31

Freek Van der Herten has a post to his site sharing a package and showing how to use it to generate a sitemap for your Laravel application automatically.

Today my company released a package called laravel-sitemap. There are already a lot of excellent sitemap packages out there. They all have in common that you have to manually add links that must appear in the sitemap. With our new package that isn’t required. It can automatically build up a sitemap by crawling a site. In this post I’d like to explain why we built it and how it works.

He starts off talking about why a sitemap might even be needed, mostly related to other automatic systems (like search engine spiders) that would use to reach even the far parts of your application. He then gets into the code, showing two examples of generating the XML document: one that's more manual and another using the "generator" to create based off of a base URL. He ends the post talking about some limitations of the package and includes a few links for further reading on the subject of sitemaps.

tagged: sitemap laravel application package example tutorial generate

Link: https://murze.be/2016/08/automatically-generate-a-sitemap-in-laravel/

Adam Culp:
Zend Framework 2 XML Sitemap
Sep 09, 2013 @ 16:15:09

In a new post to his site Adam Culp shares how he created an XML sitemap for his Zend Framework 2-based application as he made it (the SunshinePHP site) more SEO friendly.

I was pleasantly surprised to see the Navigation component of Zend Framework 2 includes a bunch of view helpers, including a Sitemap helper. So now I have an xml sitemap created by Zend Framework 2 that works hand in hand with the site navigation. However, the documentation was not complete as of this writing and caused me to do a bit of trial and error debugging to get it working. Below I will post how I got it working, in hopes it will help others.

The code to get it working is relatively simple - set it up in the module configuration, specify the navigation structure and add a route for the sitemap output. The view then accesses the navigation handling and calls a "sitemap" method to push the XML result out to the user.

tagged: xml sitemap sunshinephp zendframework2 navigation helper

Link: http://www.geekyboy.com/archives/770

PHPFive.net:
Creating a dynamic Google sitemap using the PHP5 SimpleXML extension
May 22, 2006 @ 22:59:06

On PHPFive.net, there's this new tutorial dealing with the creation of a dynamic Google sitemap with the help of SimpleXML - basically, the paths for Google to follow to best index your site.

This tutorial demonstates the PHP5 SimpleXML extension by using it to update a Google sitemap dynamically. It assumes that you have a basic understanding of PHP and are familiar with XML. SimpleXML represents a XML file as a native PHP object and this makes it a good deal easier to work with than either DOM or SAX. Using SimpleXML you can read, write or iterate over a XML file and access it's elements and attributes.

Whilst there are free online sitemap generator tools available on the Internet that allow you to create an XML sitemap which can be submitted to Google sitemaps. In order to better demonstrate the SimpleXML extension to you, we will do something useful and create a PHP function that will parse and prepend new entries dynamicly to a web sites Google sitemap.

He gets right down to it, illustrating what a sitemap looks like followed by a simple sample script to create it for that data. SimpleXML makes it a snap to generate the properly formatted XML and split it back out for Google's bots to consume.

tagged: google sitemap simplexml php5 path tutorial google sitemap simplexml php5 path tutorial

Link:

PHPFive.net:
Creating a dynamic Google sitemap using the PHP5 SimpleXML extension
May 22, 2006 @ 22:59:06

On PHPFive.net, there's this new tutorial dealing with the creation of a dynamic Google sitemap with the help of SimpleXML - basically, the paths for Google to follow to best index your site.

This tutorial demonstates the PHP5 SimpleXML extension by using it to update a Google sitemap dynamically. It assumes that you have a basic understanding of PHP and are familiar with XML. SimpleXML represents a XML file as a native PHP object and this makes it a good deal easier to work with than either DOM or SAX. Using SimpleXML you can read, write or iterate over a XML file and access it's elements and attributes.

Whilst there are free online sitemap generator tools available on the Internet that allow you to create an XML sitemap which can be submitted to Google sitemaps. In order to better demonstrate the SimpleXML extension to you, we will do something useful and create a PHP function that will parse and prepend new entries dynamicly to a web sites Google sitemap.

He gets right down to it, illustrating what a sitemap looks like followed by a simple sample script to create it for that data. SimpleXML makes it a snap to generate the properly formatted XML and split it back out for Google's bots to consume.

tagged: google sitemap simplexml php5 path tutorial google sitemap simplexml php5 path tutorial

Link:


Trending Topics: