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

Content Type "Alias"?! #60

Open
iocron opened this Issue Oct 2, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@iocron
Copy link

iocron commented Oct 2, 2018

A content type to choose from a entry of Section B inside a entry of Section A would be very helpful to be more flexible. E.g. having two sections with a structure like this:

A. Pages (multiple)

  • Title
  • Choose a Gallery

B. Galleries (multiple)

  • Image(s)
  • Caption Text

With this the user could select one of the Gallery Entries on a Pages Entry. This would be very benefical to crosslink contents between different section and to organize them, as well as reuse them in a more efficient way.

@srobbin srobbin referenced this issue Oct 5, 2018

Open

Multiple fields #6

@srobbin srobbin added the feature label Oct 6, 2018

@srobbin

This comment has been minimized.

Copy link
Contributor

srobbin commented Oct 6, 2018

@iocron Thanks for submitting this.

In the original draft for Vapid, I had something similar: type=reference. In that context, I imagined categorized links, a la https://trentwalton.com/info/.

The problem I ran into was that it would require some kind of querying mechanism for sections. e.g., {{#section links where=...}}, and I was having a hard time figuring out a simple syntax. Your example is much more straightforward and easier to imagine how it might work.

Still, I think an alias/reference directive would need to support both scenarios: referencing another record and narrowing a subset of records.

I'm curious to hear other use cases you have in mind.

@iocron

This comment has been minimized.

Copy link
Author

iocron commented Oct 7, 2018

@srobbin Thank you for your feedback. I had something similar in mind, but for simplicity and flexibility I was thinking about a new content type e.g. "alias" (or "reference") so the dashboard user can select one or multiple entries of a section inside another sections entry:

pages.html:

{{#section Pages}}
{{pageTitle type=text}}
{{pageGallery type=alias target=Galleries multiple=true label="Select a Gallery (or multiple)"}}
{{/section}}

galleries.html

{{#section Galleries}}
{{galleryTitle type=text}}
{{galleryCaption type=text}}
{{galleryImage type=image}}
{{/section}}

In Addition, referencing only parts of the section with the content type "alias" could be accomplished through a additional parameter (filter="...", similar to your "where" statement) if really needed, e.g.:
{{pageGallery type=alias target=Galleries filter="galleryTitle|galleryImage"}}

The only problem with the "filter" solution I see are regular html tags / wrappers, those are ignored, if we have something like this:
<div class="galleryImage">{{galleryImage type=image}}</div>

They would need a own section, so the wrapper (div, etc.) are included as well. Another alternative would be DOM Parent Traversal (traversing up the dom tree of the filtered element until it hits the section). Or a implementation of a dom selector, e.g.: filter=".galleryImage"

I think this solution gives the user a very modular ability to share / reference content between sections and to organize / split everything for a better overview / structure of the backend (the "filter" / where parameter would be only optional, the mentioned solution without the "filter/where" would be already great).

I see many use cases especially in Blogs / Blog Archives, Crosslinked Categories / Crossselling, creating a own section "Filemanager" for managing the images and just referencing them in other sections, custom SEO Implementations (canonical, etc.), shared Galleries, multiple views on different sections (by using filter=...), independent Navigation Trees, etc.. The possibilites are endless :)

I hope I was able to explain it well enough.

@stale

This comment has been minimized.

Copy link

stale bot commented Jan 5, 2019

This issue has been automatically marked as stale after 90 days of inactivity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Jan 5, 2019

@zohf

This comment has been minimized.

Copy link

zohf commented Jan 10, 2019

Hey! This is a great idea and would make vapid incredibly powerful. I asked a similar question in the forums here: https://forums.vapid.com/t/data-linking-is-it-possible-to-associate-data-in-multiple-places-conditionally/179

I think @iocron's idea is a good one, but unfortunately it's out of my realm of expertise to try and put a PR together for this.

@stale stale bot removed the stale label Jan 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment