These are chat archives for locomotivecms/v3

21st
Mar 2016
David Schovanec
@schovi
Mar 21 2016 13:31
@did Hello, we are facing great challenge with new locomotive. Task sounds pretty simple and straightforward, unforunatly we are stuck for long time. We want to append gallery to some pages. As gallery we imagine "add 1 or more photo to page and choose how to render them." Thanks for helping
David Schovanec
@schovi
Mar 21 2016 13:46
@did and We are stuck on part, how to assign photos to page entity. As I understand, Page does not behave as model and thus you cant simple create association.
Didier Lafforgue
@did
Mar 21 2016 14:01
hi @schovi!
Lorenzo
@sz23
Mar 21 2016 15:05
hi, do you know if it's possible to do a "groupby" over a string field?
Didier Lafforgue
@did
Mar 21 2016 15:07
hi @sz23, right now, it’s not but that’d definitively be a nice addition.
Lorenzo
@sz23
Mar 21 2016 15:12
ok! thank you
Didier Lafforgue
@did
Mar 21 2016 15:14
you’re welcome :-)
Didier Lafforgue
@did
Mar 21 2016 18:42
hi @scoobyclub
what’s in your filesystem?
scoobyclub
@scoobyclub
Mar 21 2016 18:58
Hi @did. Do you mean folder structure? If so I’ll need to recreate it as I have omitted underscores for the time being to get around it. I had the same issue when trying to include a snippet a while. It’s weird cause presumably no one else is reporting thie behaviour.
Didier Lafforgue
@did
Mar 21 2016 18:58
@scoobyclub yes, the folder structure :-)
use only underscore in snippet names
scoobyclub
@scoobyclub
Mar 21 2016 19:05
OK, I recreate it here are a couple of screen shots coming up
Didier Lafforgue
@did
Mar 21 2016 19:05
thanks @scoobyclub!
scoobyclub
@scoobyclub
Mar 21 2016 19:08

OK the screen grab pictures don’t seem to be adding

First I do this

bundle exec wagon generate page test/test_file
Do you prefer a HAML template ? no
create app/views/pages/test/test_file.liquid
create app/views/pages/test.liquid

Then I get

Started GET "/test/test_file" at 2016-03-21 19:01:43 +0000
Params: {}
Timezone: UTC
Detecting locale EN
[Tip] add a new page in your Wagon site at this location: /Users/colinmcgowan/Desktop/Toneloop Design/thehrspecialists/wagon/thehrspecialists/app/views/pages/test/test_file.liquid
Page not found, rendering the 404 page.
[404] missing editable_text "jumbotron" (content)
Completed 404 Not Found in 10.4ms

the file creates the test/test_file.liquid page OK though

I delete the underscore and I get

service=listen action=reload resource=pages timestamp=2016-03-21 19:03:17 +0000
service=listen action=reload resource=snippets timestamp=2016-03-21 19:03:17 +0000
thehrspecialists
Started GET "/test/testfile" at 2016-03-21 19:03:22 +0000
Params: {}
Timezone: UTC
Detecting locale EN
Found page "Test file" [test/testfile]
Completed 200 OK in 30.4ms

So the only difference is the underscore. Now maybe underscores are disallowed but if so Wagon should flag an error. If they are allowed then I don’t know what’s going on. I am using the local Wagon server at the moment.
Didier Lafforgue
@did
Mar 21 2016 19:12
hmmm
thanks @scoobyclub
did it create the app/views/pages/test.liquid file?
scoobyclub
@scoobyclub
Mar 21 2016 19:16
screenshot 1.jpg
Gitter doesn't like the screenshot metadata so I had to reprocess. This is after I removed the underscore but you can say it create test.liquid too.
Didier Lafforgue
@did
Mar 21 2016 19:16
thanks! alright, I’m going to see now if I can reproduce it locally
one more thing
what’s in the header of your test/testfile.liquid file?
scoobyclub
@scoobyclub
Mar 21 2016 19:17

title: Test file

true if the page is included in the menu

listed: true

true if the page is published

published: true

true if the page can be used as a layout for new pages created by the editors

is_layout: true

position among sibling pages

position: 1

sets a redirection to the given url (301)

redirect_url: "<url to a page or to a remote url>"

other unique identifier of this page. To be used with the path_to liquid tag.

handle: my-page-handle

content type that this page is templatizing

content_type: "<slug of one of the content types>"

editable_elements:

'some_block/some_slug': "<text>"

'some_block/some_slug': "<relative path to the file under the public/samples folder>"


{% extends parent %}

{% block main %}

<p>Hello world</p>

{% endblock %}

Didier Lafforgue
@did
Mar 21 2016 19:18
@scoobyclub, use the ```` xxxx
````
to format your code ;-)
scoobyclub
@scoobyclub
Mar 21 2016 19:18
title: Test file

# true if the page is included in the menu
listed: true

# true if the page is published
published: true

# true if the page can be used as a layout for new pages created by the editors
# is_layout: true

# position among sibling pages
# position: 1

# sets a redirection to the given url (301)
# redirect_url: "<url to a page or to a remote url>"

# other unique identifier of this page. To be used with the path_to liquid tag.
# handle: my-page-handle

# content type that this page is templatizing
# content_type: "<slug of one of the content types>"


# editable_elements:
#   'some_block/some_slug': "<text>"
#   'some_block/some_slug': "<relative path to the file under the public/samples folder>"
---
{% extends parent %}

{% block main %}

  <p>Hello world</p>

{% endblock %}
Ah, you learn something new everyday here :-)
Didier Lafforgue
@did
Mar 21 2016 19:19
:-)
thank you!!!
alright, I’ll keep you posted about it
scoobyclub
@scoobyclub
Mar 21 2016 19:19
Thankyou
Didier Lafforgue
@did
Mar 21 2016 20:09
@scoobyclub still around?
my conclusions :-)
  • test/test-file works
  • test/test_file doesn’t work
  • test/test_file works IF you add the “test_file" slug property in your page
scoobyclub
@scoobyclub
Mar 21 2016 20:36
Around now. Is that a bug then? Should I add the slug property for the time being?
Didier Lafforgue
@did
Mar 21 2016 22:24
not a bug, more an undocumentated behaviour. Dashes are better than the underscores when it comes to SEO. So, if you really want to use underscores, define your slug with underscores in the page header.
scoobyclub
@scoobyclub
Mar 21 2016 22:30
Hmmm, OK. Being honest I think if it allows it it to be generated then it should work not break with no explanation. I’m quite happy to change, I just tend to use underscores because it looks cleaner, I didn’t know about any SEO impact. I’m presuming you were also unaware of this behaviour given the conversation. Anyway, I shall try to change my underscore habit.
Didier Lafforgue
@did
Mar 21 2016 22:31
well, actually, I thought at first that your issue was not related to that.
what we could do is to set the slug if we find an underscore inside the path during the generation of the page
would it help?
scoobyclub
@scoobyclub
Mar 21 2016 22:43
I’m guessing other people know this convention by default, I didn’t but I do now so I’ll be fine from now on. Personally I would vote for set the slug as this allows wagon to create and serve valid files ( it is important that what it creates can be served ). However even a warning/error on the filename saying use dashes not underscores would be sufficient.
Didier Lafforgue
@did
Mar 21 2016 23:30
@scoobyclub
Screen Shot 2016-03-22 at 12.30.17 AM.png
scoobyclub
@scoobyclub
Mar 21 2016 23:31
Are you telling me I’m stupid? :-)
Didier Lafforgue
@did
Mar 21 2016 23:31
not at all! :-)
I’ve just added the warning you’d have been happy to read before posting this here!
before I commit my patch, let me know if the message is clear enough for you
scoobyclub
@scoobyclub
Mar 21 2016 23:37
I thought that I had overlooked an obvious warning. That looks fine as it warns you and points you in the right direction, much better than lots of headscratching. Thanks.
It is probably worth a mention in the quick start as a kind of tip too at some point.