Skip to content

Commit

Permalink
Apparently Google doesn't like https everywhere afterall. (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePixelDeveloper authored Sep 17, 2017
1 parent cde221c commit 4fafbbd
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions spec/OutputSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function it_should_format_a_sitemapindex_with_n_sitemaps()
{
$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://www.sitemaps.org/schemas/sitemap/0.9 https://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd" xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
<sitemapindex xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://www.example.com/sitemap1.xml.gz</loc>
</sitemap>
Expand All @@ -43,7 +43,7 @@ function it_should_generate_a_sitemap_of_images()
{
$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://www.sitemaps.org/schemas/sitemap/0.9 https://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd" xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="https://www.google.com/schemas/sitemap-image/1.1">
<urlset xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="https://www.google.com/schemas/sitemap-image/1.1">
<url>
<loc>https://www.example.com/1</loc>
<image:image>
Expand Down Expand Up @@ -101,7 +101,7 @@ function it_should_generate_a_sitemap_with_links()
{
$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://www.sitemaps.org/schemas/sitemap/0.9 https://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd" xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="https://www.w3.org/1999/xhtml">
<urlset xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://www.example.com/english/</loc>
<xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/deutsch/"/>
Expand Down Expand Up @@ -149,7 +149,7 @@ function it_should_write_processing_instructions()
$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/path/to/xslt/main-sitemap.xsl"?>
<urlset xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://www.sitemaps.org/schemas/sitemap/0.9 https://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd" xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="https://www.w3.org/1999/xhtml">
<urlset xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://www.example.com/english/</loc>
<xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/deutsch/"/>
Expand Down
4 changes: 2 additions & 2 deletions spec/UrlsetSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function it_should_only_append_attributes_once_for_each_subelement_type(XMLWrite
{
$xmlWriter->startElement('urlset')->shouldBeCalled();
$xmlWriter->writeAttribute('xmlns:xsi', 'https://www.w3.org/2001/XMLSchema-instance')->shouldBeCalled();
$xmlWriter->writeAttribute('xsi:schemaLocation', 'https://www.sitemaps.org/schemas/sitemap/0.9 ' . 'https://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd')->shouldBeCalled();
$xmlWriter->writeAttribute('xmlns', 'https://www.sitemaps.org/schemas/sitemap/0.9')->shouldBeCalled();
$xmlWriter->writeAttribute('xsi:schemaLocation', 'http://www.sitemaps.org/schemas/sitemap/0.9 ' . 'http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd')->shouldBeCalled();
$xmlWriter->writeAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9')->shouldBeCalled();

$url->getSubelementsThatAppend()->willReturn([$image, $video]);
$this->appendSubelementAttribute($xmlWriter, $image)->shouldReturn(true);
Expand Down
6 changes: 3 additions & 3 deletions src/SitemapIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public function generateXML(XMLWriter $XMLWriter)

$XMLWriter->writeAttribute(
'xsi:schemaLocation',
'https://www.sitemaps.org/schemas/sitemap/0.9 ' .
'https://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd'
'http://www.sitemaps.org/schemas/sitemap/0.9 ' .
'http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd'
);

$XMLWriter->writeAttribute('xmlns', 'https://www.sitemaps.org/schemas/sitemap/0.9');
$XMLWriter->writeAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');

foreach ($this->getSitemaps() as $sitemap) {
$sitemap->generateXML($XMLWriter);
Expand Down
2 changes: 1 addition & 1 deletion src/Subelements/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function generateXML(XMLWriter $XMLWriter)
*/
public function appendAttributeToCollectionXML(XMLWriter $XMLWriter)
{
$XMLWriter->writeAttribute('xmlns:xhtml', 'https://www.w3.org/1999/xhtml');
$XMLWriter->writeAttribute('xmlns:xhtml', 'http://www.w3.org/1999/xhtml');
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Urlset.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public function generateXML(XMLWriter $XMLWriter)
$XMLWriter->writeAttribute('xmlns:xsi', 'https://www.w3.org/2001/XMLSchema-instance');

$XMLWriter->writeAttribute('xsi:schemaLocation',
'https://www.sitemaps.org/schemas/sitemap/0.9 ' .
'https://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd');
'http://www.sitemaps.org/schemas/sitemap/0.9 ' .
'http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd');

$XMLWriter->writeAttribute('xmlns', 'https://www.sitemaps.org/schemas/sitemap/0.9');
$XMLWriter->writeAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');

foreach ($this->getUrls() as $url) {
foreach ($url->getSubelementsThatAppend() as $subelement) {
Expand Down

0 comments on commit 4fafbbd

Please sign in to comment.