Comments (6)
I don't have any immediate plans to add support, but I'm all for it!
This looks very easy to implement. There should just be two spots required to support it:
builder/sitemap_file.rb#build_xml - need a similar block to the one we use for images
link.rb#prepare_images - need a similar function for news and use it in generate()
sitemap_generator.rb#MAX_SITEMAP_NEWS - add a constant for the max news per url (should be 1000)
Let me know how you go...
from sitemap_generator.
I've created a fork and implemented this feature as you suggested. Please take a look:
https://github.com/rodrigoflores/sitemap_generator
I will write some tests before doing a pull request, but I think it is ok to get some feedback from you :)
from sitemap_generator.
Hi @rodrigoflores, thanks for working on this! News sitemaps will be great to include. I've taken a look at your code and it looks good.
The only thing missing is that we don't keep track of how many news URLs have been added to the sitemap. We should show a warning or error if there are more than the limit (1000). I think the best place is in SitemapFIle#add when we add the link to ask the link if it's a news link e.g. link.news? and increment a counter if so. See how you go...it's not a crucial part.
I've found the XSD schema here http://www.google.com/schemas/sitemap-news/0.9/sitemap-news.xsd and the description of the elements here http://www.google.com/support/news_pub/bin/answer.py?answer=74288.
Thanks for adding tests. You can take a look at the video sitemap spec file for some idea of how to use the validator (though it's not the best code).
Let me know if you need any help.
Cheers,
from sitemap_generator.
I've added the things you asked and some tests. I will write some tests to the limit and do a pull request. OK?
https://github.com/rodrigoflores/sitemap_generator/
from sitemap_generator.
Ok I've released v2.1.0. Thanks again!
from sitemap_generator.
tks kjvarga and rodrigoflores! =)
from sitemap_generator.
Related Issues (20)
- Ping failed for Bing: #<OpenURI::HTTPError: 410 Gone> HOT 2
- Feature Request: Remove unwanted options HOT 6
- Is it possible to override the default link options? HOT 3
- How to remove default priority, lastmod and changefreq from all urls HOT 1
- GoogleStorageAdapter - Can't create sitemap on buckets with uniform bucket-level access enabled HOT 3
- Allow disable acl for S3 bucket HOT 1
- Rails on Heroku with S3 sitemap hosting - google didn't like it HOT 2
- 【Worked】Ping failed for Bing: #<OpenURI::HTTPError: 410 Gone> HOT 4
- Is it possible to add additional metadata fields to the xml HOT 5
- Feature request : Make `default_host` optional / Allow full URL instead of path HOT 2
- Entity escaping in XML output
- google search console couldn't fetch sitemap but index is ok HOT 7
- Google search correct ping url HOT 2
- Readme install instructions fail HOT 1
- [BUG] Mobile sitemap link in Readme.md is giving 404
- TimeZone is ignored
- sitemap.xml.gz file not found on server
- Testing with frozen time does not work
- should sitemap show up automatically in google search console? HOT 2
- Should we drop default `lastmod` of `Time.now` as Google says "it needs to consistently match reality"? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sitemap_generator.