Sitemaps
瞭解如何為AEM Sites建立Sitemap,以利提升SEO。
設定
絕對網站地圖URL absolute-sitemap-urls
AEM的Sitemap使用Sling對應支援絕對URL。 這是透過在AEM服務上建立對應節點以產生Sitemap (通常是AEM Publish服務)來完成。
https://wknd.com
的Sling對應節點定義範例可在/etc/map/https
下定義,如下所示:
路徑
屬性名稱
屬性型別
屬性值
/etc/map/https/wknd-site
jcr:primaryType
字串
nt:unstructured
/etc/map/https/wknd-site
sling:internalRedirect
字串
/content/wknd/(.*)
/etc/map/https/wknd-site
sling:match
字串
wknd.com/$1
以下熒幕擷圖說明類似設定,但適用於http://wknd.local
(在http
上執行的本機主機名稱對應)。
Sitemap排程器OSGi設定
定義在AEM中重新/產生並快取Sitemap之頻率(使用cron運算式)的OSGi工廠設定。
ui.config/src/main/jcr_content/apps/wknd/osgiconfig/config.publish
{
"scheduler.name": "WKND Sitemaps",
"scheduler.expression": "0 0 2 1/1 * ? *",
"searchPath": "/content/wknd"
}
Dispatcher允許篩選器規則
允許Sitemap索引和Sitemap檔案的HTTP要求。
dispatcher/src/conf.dispatcher.d/filters/filters.any
...
# Allow AEM sitemaps
/0200 { /type "allow" /path "/content/*" /selectors '(sitemap-index|sitemap)' /extension "xml" }
Apache Webserver重寫規則
請確定.xml
個Sitemap HTTP要求已路由至正確的基礎AEM頁面。 如果未使用URL縮短功能,或使用Sling對應來縮短URL,則不需要進行此設定。
dispatcher/src/conf.d/rewrites/rewrite.rules
...
RewriteCond %{REQUEST_URI} (.html|.jpe?g|.png|.svg|.xml)$
RewriteRule ^/(.*)$ /content/${CONTENT_FOLDER_NAME}/$1 [PT,L]
資源
recommendation-more-help
bb44cebf-d964-4e3c-b64e-ce882243fe4d