Hi all,
Is there any way of how to get links to all the existing pages n the application? The initial task is to create an full initial index for the elastic search, and here I need to get the following data: 1. page url 2. page content
So is there some SQL request, or php solution of how to get all the existing urls in the expression engine (also search spiders are used to get such info)? The similar task is a creation of sitemap, so if is there any solutions for sitemap, I can adapt it to the my task.
Any information is useful, completed solution isn’t necessary, just the ideas are enough.
EE v2.9.3.
Thanks in advance
How you approach this will depend on how you’ve structured your site. For example, I like to create a channel called “Static page” (short name: static_page) and create other channels with short names that match the names of their associated template groups. For example, I might create a channel called “News” (short name: news) and a template group with the name “news”. Also, you might have a small number of channel entries that have been given Page URIs (for example, “About Us” or “Contact Us” pages). With a structure like this, you can build a channel entries query to output a list of page titles like so:
<ul>
{exp:channel:entries dynamic="no"}
{if page_uri != ""}
<li><a href="http://{page_uri}">{title}</a></li>
{if:elseif channel == "news" OR channel == "events"}
<li><a href="/{channel_short_name}/{url_title}">{title}</a></li>
{if:elseif channel == "static_page"}
<li><a href="/{categories">{title}</a></li>
{/if}
{/exp:channel:entries}
</ul>
The first segment of the static page URI comes from the category URL title in a special category group (id 1 in the above example). This isn’t very scalable if you’ve got a large number of static pages though. However, if you know what the first segment of these static pages will be, then that solves the scalability problem. For example, you could create a template group called “page” with an index template for displaying static pages. In that case, your static page URLs would be /page/{title}.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.