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?

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

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`

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