如何使用表达式引擎创建有效的站点地图?



我正在尝试使用ExpressionEngine创建站点地图,但是当我在验证器中加载URL时,它显示为空。

ExpressionEngine 使用通道和条目来显示内容,因此为了创建有效的站点地图,我需要通过使用{exp:channel:entries}并通过相应的通道引入内容来拉入这些通道条目。我能找到的关于在EE中创建站点地图的唯一信息来自几年前提出的一个问题,有人用几个例子和几个文档来回答(链接到问答(;但是,我的站点地图代码看起来是正确的,一些验证者说没有错误,但这仅仅是因为站点地图的网址仅显示开始和结束网址集标签及其所需信息,而没有其他内容。文件大小为 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创建有效的站点地图,而无需购买插件。

当我需要使用category_id时,我正在使用entry_id。这个简单的更改动态引入了我需要的所有网址。

最新更新