Skip to content
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

Scenario content could be imported dynamically on request #201

Open
saltednut opened this issue Jan 17, 2020 · 0 comments
Open

Scenario content could be imported dynamically on request #201

saltednut opened this issue Jan 17, 2020 · 0 comments

Comments

@saltednut
Copy link
Contributor

If a page 404's, it would be possible to use an Event Listener to trigger on the 404 event. It would then feasibly be possible to look up an index using the url pattern as the key. If the index returns a content UUID, we would then tell default_content to import that node and redirect the user to it after running the import. This would only need to happen once per page.

The way I imagine this working is to slightly alter the scenarios definition hook with an additional index called optional that would then contain a list of imports migrations files and cdf that could contain detailed indexes of default content.

For example

$var['optional'] => [
  'imports' => [
    '/news' => '251F7295-A1E9-4331-8EE1-80A0CC994758',
   '/article/why-buy-from-us' => '7B64D38C-ED17-4182-942A-4DDB07721D97'
  ],
  'cdf' => [
    '/event-listing' => '/optional/cdf/events.json'
  ],
  'files' => [
    '/event-listing' => '/optional/files/event.png'
  ]
];

As you can see from this structure, a matching URL can be found at times providing both a content import as well as a file import in the example (/event-listing). This will allow for us to deliver multiple pages via one on-demand url, or just load some extra files in addition to the node.

Most of the time, you'd just have a default content UUID that the URL matched with, but files and CDF json could also be loaded on request.

This would allow for us to build simple one-page demos that load quickly, while also allowing for a more robust demo if the track called for it.

Due to the on-demand nature, we'd recommend the SE running the demo to do their walkthrough first (practice makes perfect) so that all the on-demand content has already been loaded into their site.

The only major limitation of this type of system is when people use Views on places like the homepage. If you need to load multiple nodes for a view, you may want to provide a default set of 3-4 nodes including the homepage. However, it may be best to only have the first 3 articles loaded, just so the View doesn't look empty.

The main way to build for this would be to use Cohesion and only build things using Media and other components. You would link to content as normal, but expect to to 404 at first. Then over time, as we build out the demos, we can fill in all the broken links with actual content.

At this point Views are still in play, but I don't find them, necessary to tell a good demo. Additionally, we've had a lot of feedback from SE's that building/theming views for client demos is often a bridge too far and they are not getting into the whole Views conversation until later in the cycle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant