statamic / ssg

The official Statamic Static Site Generator
233 stars 24 forks source link

v3.3 no longer shares current_uri with SSG #107

Closed tao closed 2 years ago

tao commented 2 years ago

Bug description

I've been using current_uri with SSG for a few things, most importantly for my pagination system which broke on my production site when I upgraded to v3.3.

It shows the current_uri if you're using the web browser but SSG doesn't output it.

Screenshot 2022-08-10 at 10 19 59

When looking at the static site from SSG it just outputs / for every page.

Screenshot 2022-08-10 at 10 20 20

So my pagination system doesn't work because it outputs /1 instead of /podcasts/1 or /articles/2... but I use it in a couple of other places to dynamically show content based on the current uri, like page tabs too.

If I revert to Statamic v3.2 and SSG 0.9.0 it shows the current uri /about-us for the live website:

Screenshot 2022-08-10 at 11 33 52

And the static website:

Screenshot 2022-08-10 at 11 33 58

How to reproduce

Here's a repo (https://github.com/tao/bug-ssg-current-uri)

  1. Install everything and run php artisan serve and visit /about-us it'll show the current URI.
  2. Then run php please ssg:generate and visit /about-us it'll show the current URI
  3. Then change "statamic/ssg": "0.9.0" to "statamic/ssg": "1.0.0" and run composer update
    • It'll update SSG and the CMS to v3.3 at the same time.
  4. Run php artisan serve and visit /about-us it'll show the current URI.
  5. Then run php please ssg:generate and visit /about-us it'll won't show the URI anymore.

Logs

No response

Environment

Statamic 3.2.39 Solo
Laravel 8.83.23
PHP 8.0.21
statamic/ssg 0.9.0

---

Statamic 3.3.27 Solo
Laravel 8.83.23
PHP 8.0.21
statamic/ssg 1.0.0

Installation

Fresh statamic/statamic site via CLI

Antlers Parser

regex (default)

Additional details

I'm very upset that this broke my production site...

tao commented 2 years ago

I've been trying to figure out where the change was, these updates are not working:

3.3.19 works again and the current_uri is back. So something must have gone wrong in v3.3.20

jasonvarga commented 2 years ago

Thanks for the research. I can fix this on the ssg side, so I'll move this issue to there.