added sitemap, rss feeds

This commit is contained in:
Rushabh Mehta 2012-02-07 13:29:31 +05:30
parent 9c7fe3bce4
commit 518533fde0
8 changed files with 111 additions and 39 deletions

View File

@ -15,7 +15,7 @@ class DocType():
"""save file by its name"""
self.doc.name = website.utils.page_name(self.doc.title)
def on_update(self):
def validate(self):
"""write/update 'Page' with the blog"""
p = website.utils.add_page(self.doc.title)

View File

@ -5,84 +5,106 @@
{
'creation': '2012-01-27 12:24:03',
'docstatus': 0,
'modified': '2012-01-27 12:24:03',
'modified_by': 'Administrator',
'owner': 'Administrator'
'modified': '2012-02-07 12:59:01',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'_last_update': u'1327647244',
'colour': u'White:FFF',
'doctype': 'DocType',
'module': 'Website',
'module': u'Website',
'name': '__common__',
'section_style': 'Simple',
'section_style': u'Simple',
'show_in_menu': 0,
'version': 1
'version': 2
},
# These values are common for all DocField
{
'doctype': 'DocField',
'doctype': u'DocField',
'name': '__common__',
'parent': 'Blog',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
'parent': u'Blog',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'doctype': u'DocPerm',
'name': '__common__',
'parent': 'Blog',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'write': 1
'parent': u'Blog',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1
},
# DocType, Blog
{
'doctype': 'DocType',
'name': 'Blog'
'name': u'Blog'
},
# DocPerm
{
'doctype': 'DocPerm',
'role': 'Website Manager'
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Website Manager',
'write': 1
},
# DocPerm
{
'doctype': 'DocPerm',
'role': 'Blogger'
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Blogger',
'write': 1
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'All'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'title',
'fieldtype': 'Data',
'label': 'Title'
'doctype': u'DocField',
'fieldname': u'title',
'fieldtype': u'Data',
'label': u'Title',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'published',
'fieldtype': 'Check',
'label': 'Published'
'doctype': u'DocField',
'fieldname': u'published',
'fieldtype': u'Check',
'label': u'Published',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'content',
'fieldtype': 'Code',
'label': 'Content'
'doctype': u'DocField',
'fieldname': u'content',
'fieldtype': u'Code',
'label': u'Content',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'content_html',
'fieldtype': u'Text',
'label': u'Preview',
'permlevel': 1
}
]

View File

@ -8,6 +8,11 @@
</div>
<div class="web-side-section">
<p><a href="#!blog">All Blogs</a></p>
<h4>Subscribe</h4>
<p>
<img src="images/feed.png" style="margin-right: 4px; margin-bottom: -4px">
<a href="rss.xml" target="_blank">RSS Feed</a>
</p>
</div>
<div style="clear: both"></div>
</div>

View File

@ -5,9 +5,17 @@
<div class="web-main-section">
</div>
<div class="web-side-section">
<!-- for later
<h4>Get Updates</h4>
<p>
<input name="blog-subscribe">
<button class="btn" id="blog-subscribe">Subscribe</button>
</p>-->
<h4>Subscribe</h4>
<p>
<img src="images/feed.png" style="margin-right: 4px; margin-bottom: -4px">
<a href="rss.xml" target="_blank">RSS Feed</a>
</p>
</div>
<div style="clear: both"></div>
</div>

BIN
images/feed.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

18
rss.xml Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/python
import cgi, cgitb, os, sys
cgitb.enable()
# import libs
sys.path.append('lib/py')
import webnotes
import webnotes.auth
if __name__=='__main__':
webnotes.http_request = webnotes.auth.HTTPRequest()
from webnotes.cms import feed
xml = feed.generate()
print 'Content-Type: text/xml'
print
print xml

19
sitemap.xml Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/python
import cgi, cgitb, os, sys
cgitb.enable()
# import libs
sys.path.append('lib/py')
import webnotes
import webnotes.auth
if __name__=='__main__':
webnotes.http_request = webnotes.auth.HTTPRequest()
domain = os.environ.get('HTTP_HOST')
protocol = os.environ.get('HTTPS') and 'https://' or 'http://'
from webnotes.cms import sitemap
print 'Content-Type: text/xml'
print
print sitemap.generate(protocol + domain + '/')

View File

@ -1 +1 @@
359
360