我正在尝试使用ExpressionEngine创建站点地图,但是当我将URL加载到验证器中时,它就会显示为空。
ExpressionEngine使用通道和条目来显示内容,因此,为了创建有效的站点地图,我需要使用{exp:channel:entries}
并通过相应的通道引入内容来引入这些通道条目。我能够找到的有关在EE中创建站点地图的唯一信息来自几年前提出的一个问题,有人回答了几个示例和几个文档,供您参考(link to the Q&A);但是,我的站点地图代码看起来正确,一些验证程序说没有错误,但这仅仅是因为站点地图的URL仅显示打开和关闭urlset标签及其必需的信息,而没有其他内容。文件大小为431B。
**我也尝试过放置各自的“ channel = __”标签
<?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">
{exp:channel:entries entry_id="1"}
<url>
<loc>{site_url}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>1.00</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/about/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/activities/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/blog/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/cabins/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/conservancy/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/events/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/get-involved/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/groups/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/lodges/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/lodging/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/restaurants/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/events/details/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/blog/category/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/blog/archive/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/events/details/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/golf/course/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>monthly</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/lodges/rooms/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>monthly</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/parks/restaurant/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/parks/promotions/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
{parents field="rel_promo_to_park"}
<loc>{site_url}/parks/promotion-details/{url_title}/{parents:url_title}</loc>
{/parents}
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
</urlset>
我正在寻找一种无需购买插件即可使用ExpressionEngine创建有效站点地图的方法。
答案 0 :(得分:0)
当我需要使用entry_id
时,我正在使用category_id
。这个简单的更改动态地引入了我需要的所有URL。