Split your feeds into multiple pages
How to paginate self-built XML feeds from landing pages with the query parameter ?p=. Avoid timeouts on large feeds.
If you build a feed yourself via a landing page, it can become so large that the system cannot generate the entire file in one go. The result is timeouts, empty files or feed receivers that can't read the XML. The solution is to split the feed into several smaller pages with a simple query parameter in the URL.
This guide explains how to paginate your feed correctly, which parameter to use and how to fetch all the pages from an external server.
Important: The parameter is called p. If you use ?page= instead, the parameter will be ignored and you will get the first page every time.
How to paginate your feed
Add ?p= followed by a page number to your feed URL. The page count starts at 0, so ?p=0 is the first page, ?p=1 is the second page and so on:
https://dinshop.dk/landingsside-feed (same as ?p=0) https://dinshop.dk/landingsside-feed?p=0 (first page) https://dinshop.dk/landingsside-feed?p=1 (second page) https://dinshop.dk/landingsside-feed?p=2 (third page)
The number of products per page is controlled by the limit you set on the landing page itself. You keep increasing the page count until the page no longer returns any more products.
Note: If the page count is higher than the number of pages that actually exist, Shoporama will either return a blank page or redirect back to the first page. Therefore, stop pagination as soon as a page returns 0 products.
When is this necessary?
- Feeds with many products can timeout or run out of memory if the entire file is generated at once
- Partner networks such as Google Shopping and Partner Ads can receive feeds split across multiple URLs
- Improves performance and reduces the risk of errors because each page is generated quickly
- It makes it easier to troubleshoot one segment at a time if something goes wrong
Example: Fetch all pages in a script
If you fetch your feed from an external server (e.g. in a partner cron task or your own script), you can loop until there are no more products:
$page = 0; while (true) { $url = "https://dinshop.dk/landingsside-feed?p=".$page; $xml = file_get_contents($url); if (empty(trim($xml)) || stristr($xml, "<item>") === false) { break; } // save or process the content here $page++; }
Use the tag that marks a product in your particular feed format. In the example it is <item>, but it could also be <product> or something completely different, depending on your own template.
Pagination in blog and product listings
The same ?p= convention is also used in your eCommerce blog and on regular product landing pages. It's a common pattern across Shoporama, so you can reuse the same logic everywhere.
Use with external feed receivers
Most feed receivers (Google Merchant Center, Partner Ads, Pricerunner, etc.) either accept multiple feed URLs or you can combine them into a single file on your end before you submit it. Ask your advertising partner which setup they prefer.
Tip: If you use one of Shoporama's built-in feeds (Google Shopping, Pricerunner, etc.), the splitting is handled automatically and you don't need to worry about pagination.
Frequently asked questions
Why is the parameter called p and not page?
It's a historical choice in Shoporama's frontend. The short form p is used on blogs, landing pages and feeds. Therefore, always use ?p=. If you write ?page=, the parameter is ignored and you get the first page every time without any error message.
Does the page count start at 0 or 1?
At 0. ?p=0 gives the first page, ?p=1 gives the second page and so on. The URL with no parameter at all also gives the first page.
How many products are there on a page?
This is controlled by the landing page limit. You can find the field under Content, Landing pages in your admin when you edit the landing page in question. A good starting point is 500 to 1000 products per page, but it depends on how heavy your product data is.
What do I do if my feed is still too slow?
Lower the number of products per page and run more calls instead. At the same time, make sure you don't include too many expensive fields, such as uncached calculations or complicated if constructs in your XML template. Still having problems? Write to support@shoporama.dk and we'll take a look.
How do I know that I have downloaded all pages?
When a page returns an empty list or redirects you back to the first page, there are no more products. Stop the loop there. This is safest because Shoporama handles overflow to the first page itself.
Can I send a single URL to Google Merchant Center?
If you're using Shoporama's built-in Google Shopping feed, yes. If you use a self-built feed via a landing page, you'll need to either submit multiple URLs or merge the pages into one file yourself before uploading. Ask your partner which they prefer.
Will I get duplicates if a product changes pages between two calls?
This can happen if new products are created or removed while you are fetching the feed. The likelihood is small in practice, but if you want to be absolutely sure, run the entire pagination close together or deduplicate on id after collecting all pages.
Can I paginate my eCommerce blog in the same way?
Yes, you can. The blog uses the same ?p= parameter with 10 posts per page by default. It's the same pattern, so your pagination links in the theme can reuse the logic.
Should I put canonical tags on the paginated pages?
On normal landing pages, Shoporama automatically sets the canonical tag to include the ?p= parameter, so each page has its own canonical. On self-built feeds, this is usually not something you need to worry about as the feed is consumed by a script and not indexed by search engines.
What if my ad partner can't handle multiple URLs?
Then you'll need to compile the pages into one file yourself before you submit it. Create a small script that fetches all pages, removes the XML header from page 2 onwards, and compiles it all into one valid XML file that you save on your own server. Then use the compiled file URL at the partner.
Do you need help? Contact us at support@shoporama.dk.
Related articles
Build your own feeds
Guide to building your own product feeds in CSV, XML or JSON format with Shoporama's custom feed feature.
Set up Google Shopping Feed
Guide to setting up Google Shopping Feed in Shoporama so that your products appear in Google Shopping.
Priceshape feed
Guide to setting up a Priceshape feed on your Shoporama online store via an XML file and a landing page.
Include color and size in Partner Ads feed
Guide to adding color, size and gender to your Partner Ads feed in Shoporama via product profiles and extra fields.
Images on landing pages
How to upload images to a Shoporama landing page and display them correctly in your theme with getImages() and getSrc().
Blog linked to your shop
Complete guide to the blog feature in Shoporama - create posts, schedule publishing, link products, optimize for search engines and use dynamic...