kentico-ericd / kontent-google-sheets-add-on

Using this Google Sheets add-on, you can import new content items in Kentico Kontent, or update existing items. This can be handy when migrating content from an external database or CMS, or if your editors prefer to work in spreadsheets.
MIT License
4 stars 3 forks source link

Support for content type snippets #1

Closed timfenton closed 4 years ago

timfenton commented 4 years ago

Hey Eric! Awesome addon :)

Is your feature request related to a problem? Please describe. Importing into more complex types with content type snippets does not work.

Describe the solution you'd like Would like to be able to import all fields including content type snippet fields as fields directly in the google doc.

ex. columns name | somefield | mycontentsnippetfieldone | mycontentsnippetfieldtwo

should import with name as the codename, somefield is a direct field on the content item, then mycontentsnippet_fieldone will populate the fieldone field within the snippet.

Describe alternatives you've considered Make some special notation to indicate that it is a content type snippet i.e add "cts!" as a prefix to the content type snippet. I am worried that if you just use contentsnippetname__fieldname then if someone accidentally names a field with double underscore it will think it is a snippet and cause issues. Maybe there needs to be a way to detect these. Havent looked into it enough

kentico-ericd commented 4 years ago

Hello @timfenton! I just updated the add-on to v13 to support snippets. They should be generated the same as any other element I don't think there should be any issues with naming 😏

You might need to re-install the add-on to test it. Let me know if it works for you!

timfenton commented 4 years ago

thanks @kentico-ericd ! So fast...

How would you expect an sheet to be formatted to import content + snippet? here is an example of how our sheets are currently formatted:

name | contentcardheadline | contentcarddescription My Product | My Product Headline | My Product Description

My hope was it would recognize that contentcard__headline is a content-type snippet field, not a field directly on the content-type, but it doesnt seem to import the data. Should i format the data differently? or, do i need to create the product feature content item first and then get the GUID for a contentcard item and send the data for that separately using the new snippet endpoint?

Thanks again!

kentico-ericd commented 4 years ago

Are you using the Generate option in the add-on, or manually specifying the headers?

The format for snippet headers should just be the code name of the snippet element. For example, I tested using the Metadata snippet in the sample project. The code name of one of the elements is metadata__meta_title

snippet

That's the same as what the add-on generates, and importing this row worked for me:

sheet

timfenton commented 4 years ago

I was not using the generate, but I was using the codenames as the headers.

actually, the issue was that i did not have en-US as a localization in the project, instead it was just "default" so it just created a content item without translation so i think this caused an issue when trying to save the content snippets. as soon as i created an en-US localization and specified it the issue went away and gave me a new issue where the the rich text was not encapsulated in some Kontent-supported tag, which I was able to workaround 👍

you the best @kentico-ericd

kentico-ericd commented 4 years ago

Hmmm... maybe it needs better messaging/error handling for the language issue 🙄 Thanks for testing it out though, enjoy Timmy boy!