Discussions

Ask a Question

Handlebar helper Truncate Text?

Has anyone succeeded in using an handlebar helper that converts a full html description into a truncated plain text description? The only thing I could find is the truncate helper: Handlebars.registerHelper ('truncate', function (str, len) { if (str && str.length > len && str.length > 0) { var new_str = str + " "; new_str = str.substr (0, len); new_str = str.substr (0, new_str.lastIndexOf(" ")); new_str = (new_str.length > 0) ? new_str : str.substr (0, len); return new Handlebars.SafeString ( new_str +'...' ); } return str; });

Workflow/content staging for single item templates

The following page states that workflow/content staging is only implemented for multi-item templates: https://opencontent.readme.io/docs/workflow-content-staging Are there any plans to add support for single item templates? If not, are there any recommendations on how one might approach this if they were looking to do it themselves?
ANSWERED

Live Edit is Fantastic....yet

I imagine whomever created this its still a work in progress but wondering if a save option has been figured out yet as well as a warning if a user tries to delete an option and better yet restore a deleted option if it is in fact deleted.

Why would a HTTP 404 occur?

I have a DNN Platform 09.01.01 website where OpenContent 04.02.00 is installed. When I add OC to a page, it never finishes loading. Instead, there are HTTP 404 errors reported for the API endpoints in the console, see below. Is this a bug and/or something you've seen before? What is the fix for this? https://example.com/API/OpenContent/InitAPI/GetTemplateState https://example.com/API/OpenContent/InitAPI/GetTemplates Following those two 404 errors, the following error is reported by OC: "fail is not defined" Here is the line of code reported for that: https://www.screencast.com/t/cmDiUVhx1
ANSWERED

Possible to limit number of items in NON Multi item template

Wonder if you clone a instance if you can have one display only a certain number of items without using the multi item template.
ANSWERED

{{AdditionalData.Intro.Title}} should be {{AdditionalData.intro.Title}}

In the templates there's a token placed, by default, {{AdditionalData.Intro.Title}}. imo that only works if you change this to {{AdditionalData.intro.Title}}.
ANSWERED

"Index": true or "index": true?

In the manifest, almost on top of the document, it reads by default: "Index": true Should that not be "index": true?
ANSWERED

Handlebar token for Portal URL?

Is there a token that can be used in the template for this?

Chained/Nested Helpers Inside {{each}} Don't Work

Is this a bug? I have the following code that works without issue. {{#equal Settings.Setting1 "value1"}} {{#equal Settings.Setting2 "value2"}} <p>I can see this rendered.</p> {{/equal}} {{/equal}} However, the following example will not rended properly. {{#each Items}} {{#equal ../Settings.Setting1 "value1"}} {{#equal ../Settings.Setting2 "value2"}} <p>This does not get rendered.</p> {{/equal}} {{/equal}} {{/each}} I know the values are there and are being called correctly (since the path is off a level due to the {{each}} loop. This works on its own, outputting the expected setting values. {{#each Items}} {{../Settings.Setting1}} {{../Settings.Setting2}} {{/each}} This doesn't even work... {{#each Items}} {{#equal ../Settings.Setting1 "value1"}}{{../Settings.Setting1}}{{/equal}} {{#equal ../Settings.Setting2 "value2"}}{{../Settings.Setting2}}{{/equal}} {{/each}} Oddly enough, this works though... {{#each Items}} {{#equal ../Settings.Setting1 "value1"}}I see this...{{/equal}} {{#equal ../Settings.Setting2 "value2"}}... and this too{{/equal}} {{/each}} In a final related test, this doesn't work. {{#each Items}} {{#equal ../Settings.Setting1 "value1"}} I see this... {{#equal ../Settings.Setting2 "value2"}} ... but not this one!!! {{/equal}} {{/equal}} {{/each}} Does anyone know why this works consistently outside of the {{each}} but not inside of it?

Equal for Multiple Possible Values?

I have a setting in a template that is a select list. In the template itself, I need to check to see if the setting value is one of multiple possibilities. I'm not sure how to do that with Handlebars and searching hasn't yet helped me find what I'm looking for. Here's what I'd like to do in the template, if the syntax supported it. {{#equal Settings.LayoutStyle "bottom-standard" || "bottom-justified" || "bottom-centered"}} <!-- my html content --> {{/equal}}

Error Error using template Bootstrap 3 Carousel

I installed the OpenContent 04.03 module, imported the Bootstrap3Carousel.zip template, but the carousel does not work, it shows the following error: Uncaught TypeError: $(...).carousel is not a function at HTMLDocument.<anonymous> (template.js?cdv=42:3) at fire (jquery.js?cdv=42:1037) at Object.fireWith [as resolveWith] (jquery.js?cdv=42:1148) at Function.ready (jquery.js?cdv=42:433) at HTMLDocument.completed (jquery.js?cdv=42:103)

Improve SEO on multi item templates

I was wondering.. I have some multi item templates in use and noticed something regarding SEO. As an example an articles template. I noticed few things that are not optimal IMO, maybe we can somehow improve on this? When the detail-url does not resolve to an item, the list is rendered So I can have www.mysite.com/Articles/id/10 which resolves to an article but www.mysite.com/Articles/id/11 (which does not exist) shows the list of articles. Wouldn't it be better to generate a 404 when there's an id present and not found? I noticed this when a client added articles, which were indexed by Google and later removed them. Google now complains about duplicate content because there are multiple urls to the same list of articles. www.mysite.com/Articles and www.mysite.com/Articles/id/11 Not sure how one could handle this in combination with the Url REwriter provider..?

DNN Search Index

Hi, I know it is possible to have the data indexed bij DNN Search. Simply by adding this to a template main section in manifest.json: "dnnsearch": true, "dnnSearchTitle": "{{Title}}", "dnnSearchDescription": "{{convertHtmlToText Description}}", "dnnSearchText": "{{Title}} {{convertHtmlToText Description}}", However, I've come to the conclusion that not everything that is showed/added in that template is indexed. For example the intro title and description and some custom additionalData fields. Also, I really would like to be able to choose which module is indexed and which is not. In my recent case I have 2 modules, each filled with hundreds of questions and answers. These faq's I use through-out the website on multiple pages. So, I use a single source to display the content on multiple pages, often filtered by a certain field. This way was mandatory in order to create an orderly and easy way of administer the FAQ's. When I _deselect_ the module Advanced Settings 'Allow Indexing' of the 2 source modules and _select_ this setting in all other modules, I would expect the 2 source modules not indexed and all other modules indexed. Sadly this is not the case. Any advise, tips or examples are welcome!

Troubleshooting: Sequence contains more than one element

What's the best way to troubleshoot the template to figure out how/why this error occurs? `Sequence contains more than one element`
ANSWERED

OpenContent conflicts with Porto Theme

I'm trying to use one of the shortcodes in Porto with OpenContent. When I do, I get the following JS error every page load when logged in as an admin and it repeats for any action I attempt to perform with the resulting templated content. https://www.screencast.com/t/iCtmINM7CzEf Has anyone else dealt with this and found a way to resolve the issue?
ANSWERED

Block Parameters

Is this supported in the latest version of OpenContent? https://handlebarsjs.com/block_helpers.html When I try to use it, I get the following error reported by the template: Sequence contains more than one element

Tutorial or example of Multilanguage?

I'm not really understanding the instructions on how to make multi language work with the text editor. I just want to be able to add French or English. Do you have a template or example of one that is already finished? So far I made an options.json file and put it in the /OpenContent/Files directory
ANSWERED

Is there a token that either is show or hide if Admin or role based

Handlebar token for DNN roles? Is there a way to do that inside the main template?

Check if date current in helper.

Hi guys, Struggling to write a custom helper, inside of my template.hbs I have created `checkActive` to see if the moment from the context given is past a certain point, however attempting to use the following code in a block will throw an error. ``` <script> Handlebars.registerHelper('checkActive', function (context) { if (window.moment && context && moment(context).isValid()) { return moment(context) =< moment(); } else { return context; // moment plugin is not available, context does not have a truthy value, or context is not a valid date } }); </script> ``` ``` <div class="text">Clos{{#checkActive Dates.EndDate}}ed{{else}}ing{{/if}}</div> ``` ``` Failed to render Handlebar template Portals/0/OpenContent/Templates/.../template.hbs Value cannot be null. Parameter name: test ```
ANSWERED

open and close dates

A client wishes to add an active date to the opencontent data and show if the current date is passed the active date. Is this possible with handlebars, I've looked at using a custom handlebars function but the Handlebars.registerHelper function is not working. Has anyone used custom handlebars functions and if so can you please outline how to add them to a module.