Update generator.py

Making sure to have the proper request when working with class instances in sitemaps. In other case, vars in session behave erratic.
Update views.py

Adding links to the index just when the sitemap has items.
Merge remote-tracking branch 'upstream/master'
Changes after pull request
Merging with original fork
Improving site item s count to avoid to call method twice.