Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where is the value of default_host coming from #51

Closed
antani opened this issue Nov 20, 2011 · 9 comments
Closed

Where is the value of default_host coming from #51

antani opened this issue Nov 20, 2011 · 9 comments

Comments

@antani
Copy link

antani commented Nov 20, 2011

I have put the following config:
SitemapGenerator::Sitemap.default_host = "http://cheapr.me"

When I generate the site map, the "loc" is coming up as :
http://cheapr.in/
Check -http://cheapr.me/sitemap.xml
I grep'd but there nowhere there is "cheapr.in" in any of the files in my project (I confess that I had originally planned to have my site - cheapr.in) - so unless there is some spooky mind-reading going on, how is the LOC changed to cheapr.in ?

From where is this domain picked up (and why my default_host is ignored ?)

@kjvarga
Copy link
Owner

kjvarga commented Nov 22, 2011

Can you paste in your sitemap config? And what version of sitemap generator are you running?

I can't think of any reason why your default_host would be ignored...

@kjvarga
Copy link
Owner

kjvarga commented Nov 22, 2011

The only way I can think of is if you are passing in full URLs to the add() method e.g.

add root_url

When it should be: add root_path.

@antani
Copy link
Author

antani commented Nov 23, 2011

I am not adding anything in the "create"

@antani
Copy link
Author

antani commented Nov 23, 2011

Sorry, I have the following entry in the "create" node.

SitemapGenerator::Sitemap.default_host = "http://cheapr.me"
SitemapGenerator::Sitemap.create do
add "/view"
end

@kjvarga
Copy link
Owner

kjvarga commented Nov 23, 2011

Your config looks good. When I run it in a test Rails app it generates URLs with the correct hostname.

The sitemap you link to doesn't look like it matches the one you are generating. I would suggest deleting the sitemaps in public/ and then running your sitemap gen again.

Finally to be absolutely sure that you are seeing the correct sitemaps, you can call add like so:
add '/view', :host => 'http://anotherhost.com'

This forces the host for that URL. If you don't see anotherhost.com then you're not seeing the right sitemaps.

@antani
Copy link
Author

antani commented Nov 24, 2011

I removed the earlier sitemap files, modified the "add" line with
add '/view', :host =>"http://cheapr.me"
and regenerated the sitemaps. Now, there are two files generated (no sitemap.xml is generated)
sitemap1.xml.gz
sitemap_index.xml.gz
When I try to check http://cheapr.me/sitemap.xml I see 404

@kjvarga
Copy link
Owner

kjvarga commented Nov 24, 2011

The sitemaps are compressed using GZip. You can uncompress them using WinZip, 7Zip or other tools. Then you can see the xml.

Note that the URL for your sitemap is: http://cheapr.me/sitemap_index.xml.gz

@kjvarga kjvarga closed this as completed Nov 24, 2011
@antani
Copy link
Author

antani commented Nov 25, 2011

Thanks, I tried to expand the sitemap_index.xml.gz file - this file
contains - sitemap_index.xml
sitemap_index.xml file looks like :



http://cheapr.me/sitemap1.xml.gz
2011-11-24T04:12:27+00:00

Is the "loc" element pointing correctly ?

Thanks,

Ved
http://ved-antani.com

On Fri, Nov 25, 2011 at 1:05 AM, Karl Varga <
reply@reply.github.com

wrote:

The sitemaps are compressed using GZip. You can uncompress them using
WinZip, 7Zip or other tools. Then you can see the xml.

Note that the URL for your sitemap is:
http://cheapr.me/sitemap_index.xml.gz


Reply to this email directly or view it on GitHub:
#51 (comment)

@kjvarga
Copy link
Owner

kjvarga commented Nov 25, 2011

Yes it's correct. http://cheapr.me/sitemap1.xml.gz is the sitemap file with your '/view' URL in it. You can remove the :host option from your call to add() now because everything is working correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants