-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using :check in if statement does not work. #3
Comments
Hi @robhuska! From looking at your snippet everything seems fine... 🤔 I'll try and find some time to open a project where I used this addon last and test the same logic. |
@aryehraber Thank you! That would be greatly appreciated. If it helps, I am on the latest version of Statamic 2. |
Hey @robhuska, I just tested this myself and seems to work fine. I used this snippet (similar to yours):
As you would expect, on first load I see the message "Cookie not found..." and then upon refreshing I see "Cookie found: hello". I'm honestly not sure what to suggest on your end... Only difference I see (which I don't think will change anything) is spaces around the check tag: |
I also just tested the inverse and works fine too:
Could there be some other caching at play? |
I just tried removing the extra spaces and correct, that did not change anything... I am running a site locally if that makes a difference? such as |
And actually I just double check on our staging site, it is not working there either. So it is not a local thing. |
Ok cool, good you checked on staging too! Are you able to share the codebase (or a reduced test case) so that I can test on my end? Probably the quickest way to get to the bottom of this (I hope)! |
Yeah, I would be willing to do so. Just not sure the best way to do so. |
Assuming you're using default Statamic (just flat-files), you should be able to just zip up the project folder and send it over (might be worth removing any cached images and the If you don't want to share over GH (understandable) then you can email me at: [email protected], if the zip file is too large for an email you can use WeTransfer. |
OK, I will get this packed up and set over in a few minutes! Thank you so much for your help! |
Ok great, I'll try and take a look tomorrow and get back to you if I find anything noteworthy. |
Thanks, I am sending a wetransfer now. I stripped out most, but I wanted to leave as much as possible of the core site stuff incase that is where my issue lies. Let me know if/when you get the transfer. |
Hi @robhuska! Thanks for sending that over, I was able to get a better understanding of what is going on and it seems you've come across a Statamic bug! I'll be reporting this to their GH issues later this week, but you may not get a fix for this soon. The issue is that custom tags don't seem to initialise in time while being called inside a content loop (your Assuming this greeting hero is unique to the Homepage, I suggest you extract this into normal content (not nested as part of a Will be sure to close this issue once fixed, so will keep open for the time being. |
Wow! Thanks for digging that one out. I will be able to implement your solution for now. Initially it is for the homepage, but would eventually like the ability to use cookies elsewhere. Thanks again! |
Hello, thank you for your Addon, I am really hoping to get this worked out because this will be a fantastic addition if I can make this work... I have the below code in my template, but it will only ever get into the first part of the if. Even after setting the cookie and on refresh it never makes it into the else. Is there something i am missing or doing incorrect?
Even trying to
{{ cookie_monster:retrieve key="welcome" }}
before the if statement, it will output the value of the cookie "hello" but still not run the else.Thank you,
Rob
The text was updated successfully, but these errors were encountered: