# Challenges in updating notes blog from CMS Vs. 1 to CMS Vs. 2

**URL:** <https://forums.realmacsoftware.com/t/challenges-in-updating-notes-blog-from-cms-vs-1-to-cms-vs-2/56353>\
**Category:** Elements\
**Created:** [May 27, 2026, 2:51pm UTC](https://forums.realmacsoftware.com/t/challenges-in-updating-notes-blog-from-cms-vs-1-to-cms-vs-2/56353 "2026-05-27T14:51:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Netroamer13](https://avatars.discourse-cdn.com/v4/letter/n/54ee81/32.png) [@Netroamer13](https://forums.realmacsoftware.com/u/Netroamer13)\
**Post date:** [May 27, 2026, 2:51pm UTC](https://forums.realmacsoftware.com/t/challenges-in-updating-notes-blog-from-cms-vs-1-to-cms-vs-2/56353/1 "2026-05-27T14:51:21Z")

</div>

After upgrading to Elements CMS 2.0 I encountered several challenges in getting the “related items” work again and in converting to pretty URLs. Consulting Claude pointed to a number of possible bugs and proposed manual fixes to the generated PHP files and CMS library. It was a bit tedious process, but my notes blog is now up and running again, with pretty URLs. Since these manual fixes might be overwritten by future updates I’m reporting them here so they can hopefully be considered in future updates.

**Challenge 1: Generated index.php uses relative paths, breaking getRelatedItems()** In the generated `notes/post/index.php`, `$sourcePath` is set as a relative path (`'../../cms/posts'`). This works for loading the current post, but when `getRelatedItems()` is called internally, the working directory may differ and the relative path fails to resolve. Fix: use ` __DIR__. '/../../cms/posts'` instead.

**Challenge 2: Wrong query parameter in third IIFE** In the same generated file, the third IIFE block reads `$slug = $_GET['tag'] ?? $_GET['slug'] ?? null` instead of `$_GET['item']`. This causes the related items component to always load the wrong post, returning no results.

**Challenge 3: Pretty URLs hardcoded to false in collection index.php** In the generated `notes/index.php`, `$prettyUrls` is hardcoded as `'false' === 'true'`, which always evaluates to `false`. This means post links on the overview page always use `?item=` query parameters even when pretty URLs are configured. Fix: use `$prettyUrls = true` or `\CMS\CMS::detectPrettyUrls()` with appropriate context.

**Challenge 4: date field renamed to date\_published in CMS 2.0, but getRelatedItems() not updated** The CMS 2.0 migration renamed the `date` frontmatter field to `date_published`, but the related items scoring and sorting logic still references the old `date` field. Posts migrated from CMS 1.0 that only have `date_published` are therefore excluded from related item results.

**Challenge 5: Post shows itself as a related item** The self-exclusion check in `Collection::getRelated()` only compares slugs (`$item->slug() !== $sourceItem->slug()`). Due to date-prefixed filenames, slugs can differ between the loaded item and its file representation, causing a post to appear in its own related items list. Fix: also compare filenames and titles.

Hope this is helpful. Happy to share the corrected code if useful.

---

<div class="post-metadata">

**Author:** ![ben](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/ben/32/28488_2.png) [@ben](https://forums.realmacsoftware.com/u/ben)\
**Post date:** [May 28, 2026, 2:18pm UTC](https://forums.realmacsoftware.com/t/challenges-in-updating-notes-blog-from-cms-vs-1-to-cms-vs-2/56353/2 "2026-05-28T14:18:05Z")

</div>

Hi @Netroamer13

Thanks for the detailed report, that’s very helpful.

I think we’ve already fixed most of the issues you’ve reported here, but I’ll go through them one by one and ensure we’ve got a fix in place in the next release 🙂

---

<div class="post-metadata">

**Author:** ![Netroamer13](https://avatars.discourse-cdn.com/v4/letter/n/54ee81/32.png) [@Netroamer13](https://forums.realmacsoftware.com/u/Netroamer13)\
**Post date:** [June 5, 2026, 12:21pm UTC](https://forums.realmacsoftware.com/t/challenges-in-updating-notes-blog-from-cms-vs-1-to-cms-vs-2/56353/3 "2026-06-05T12:21:27Z")

</div>

Hi @Ben, many thanks for your swift answer. In the meantime, I have upgraded to Elements vs. 2.4.4 and adjusted the item on my post page with a dynamic url ({{item.title}}), following your latest CMS video (really helpful). When publishing my site afterwards, I again got error messages (blank pages instead of my individual posts). I had to adjust the 2 index.php-files in 2 folders (1. notes and 2. post). It is a bit tedious to update these files manually after each publishing. Could you therefore let me know which of the above 5 issues you have already fixed and if the remaining issues could be covered by another update. That would be great. Or would there be another workaround?

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/3X/9/7/97ba3329637c28a1001cbdcfca516712483e3d6c.png)

---

<div class="post-metadata">

**Author:** ![ben](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/ben/32/28488_2.png) [@ben](https://forums.realmacsoftware.com/u/ben)\
**Post date:** [June 6, 2026, 4:34pm UTC](https://forums.realmacsoftware.com/t/challenges-in-updating-notes-blog-from-cms-vs-1-to-cms-vs-2/56353/4 "2026-06-06T16:34:40Z")

</div>

could you send me your project? It’s hard for me to track exactly which issues you’re seeing and what a fix might be without seeing the site.

Also, are you seeing any errors on the page? Or what is it exactly that still not working for you? 🙂
