Creating a Sitemap Blog Website with Xml, Jave
Written by Web-design.wapka.top on · Updated on
Basic setup
Let's start by creating a new page called robots
, which will display a single Robots from your blog. On that page, add the following imgcode function:
- Code:
User-agent: *
Sitemap: https:// your site mane/sitemap.xml
2nd setup
Let's start by creating a new page called rss
, which will display a single rss from your blog. On that page, add the following imgcode function:
- Code:
local rss = [=[<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
>
<channel>
<title>K2NBLOG.cc - Free Download Latest Musics</title>
<atom:link href="https:// your wapka site mane/rss.xml" rel="self" type="application/rss+xml" />
<link>https://your wapka site mane/</link>
<description>Free Download Latest Musics</description>
<lastBuildDate>%s</lastBuildDate>
<language>id-ID</language>
<sy:updatePeriod>
hourly </sy:updatePeriod>
<sy:updateFrequency>
1 </sy:updateFrequency>]=]
print(string.format(rss, os.date("%a, %d %b %Y %X +0000")))
local param_post = {
limit = 20,
order = "DESC"
}
local post_html = [=[
<item>
<title>%title%</title>
<link>https://your wapka site mane/post/%id%/%title|url.slug%</link>
<dc:creator>Admin</dc:creator>
<pubDate>%date%</pubDate>
<category>%forumname%</category>
<description><p>%content%</p>
The post <a href="https:// your wapka site mane/post/%id%/%title|url.slug%">%title%</a> first appeared on <a href="https// your wapka site mane/">K2NBLOG.cc</a>.</description>
<content:encoded><p>%content%</p>The post <a href="https:// your wapka site mane/post/%id%/%title|url.slug%">%title%</a> first appeared on <a href="https://hdfilm4u.wapka.top/">K2NBLOG.cc</a>.</content:encoded>
<slash:comments>0</slash:comments>
</item>
]=]
local is_ok, postlist = api.post_info(param_post)
print(html.render_tag(post_html, postlist, true));
print("</channel>")
print("</rss>")
Basic setup
Let's start by creating a new page called sitemap
, which will display a single sitemap from your blog. On that page, add the following img code function:
- Code:
local sitemap = [=[<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<!-- created with Free Online Sitemap Generator www.xml-sitemaps.com -->
<url>
<loc>https://your wapka site mane</loc>
<lastmod>%s</lastmod>
<priority>1.00</priority>
</url>
<url>
<loc>https:// your wapka site mane/index.html</loc>
<lastmod>%s</lastmod>
<priority>0.80</priority>
</url>]=]
print(string.format(sitemap, os.date("%Y-%b-%dT%X+07:00"), os.date("%Y-%b-%dT%X+07:00")))
local param_category = {
parent = 0,
limit = 20,
order = "DESC"
}
function date()
return os.date("%Y-%b-%dT%X+07:00")
end
local category_xml = [=[
<url>
<loc>https:// your wapka site mane/category/%id%/%name|url.slug%</loc>
<lastmod>%name|date%</lastmod>
<priority>0.80</priority>
</url>]=]
local is_ok, categorylist = api.forum_info(param_category)
print(html.render_tag(category_xml, categorylist, true));
print("</urlset>")