In CQ's cq:IncludeClientLib, what's the difference between theme and categories attributes? - aem

According to the docs:
categories
A list of comma-separated client lib categories. This will include all Javascript and CSS libraries for the given categories. The theme name is extracted from the request.
Equivalent to: com.day.cq.widget.HtmlLibraryManager#writeIncludes
theme
A list of comma-separated client lib categories. This will include all theme related libraries (both CSS and JS) for the given categories. The theme name is extracted from the request. Equivalent to: com.day.cq.widget.HtmlLibraryManager#writeThemeInclude
I am new to CQ and this looks a bit vague to me. What's the difference between these attributes?

Suppose you had the following in the JCR:
- /etc/clientlibs/grid
- /etc/clientlibs/forms
- /etc/clientlibs/tables
- /etc/clientlibs/tables/responsive
- /etc/clientlibs/tables/inverse
categories should pull in a list of un-related Client Libraries. For instance <cq:includeClientLib categories="grid, forms, tables" />
themes should pull in distinct related Client Libraries. Or probably better described as sub-categories. For instance, <cq:includeClientLib categories="tables" themes="inverse, responsive" />
The difference is themes resides inside of a category. tables could contain but "sub-categories" (or themes), but you have a good reason for breaking them out. You want to use your general tables category on ALL your pages & designs, but certain pages would want an inverse display of the tables. Or only certain pages contain responsive tables.
I thought CQ5.5 had better examples in the code, but CQ5.6 doesn't appear to have much OOB anymore.

Related

Can exams2moodle export additional metainfo such as idnumber and tags?

When I export the xml file of a multiple choice question, it contains the following lines:
<idnumber>arbitrary_id_set_by_user</idnumber>
<answernumbering>ABCD</answernumbering>
<tag></tag>
Is there a way to add idnumber, answernumbering and tag to the metainformation section of the question so that r-exams can export to moodle XML as <idnumber>idnumber</idnumber>,<answernumbering>ABCD</answernumbering>, <tag>tag1</tag>, and <tag>tag2</tag> etc?
The <answernumbering> tag can be set in exams2moodle() via the answernumbering= argument, see ?exams2moodle. The reason for this is that this is set in the same way for all exercises in a quiz. This is more consistent than setting it individually and potentially inconsistently in the meta-information of the different exercises.
The <idnumber> tag appears to be used by Moodle only for internal purposes. It is also not mentioned in the official Moodle XML documentation at https://docs.moodle.org/311/en/Moodle_XML_format. Hence we did not implement it in exams2moodle().
The <tag> is currently not supported in exams2moodle() because we felt that it would be more important to have tags in the Rmd (or Rnw) exercise itself and not the Moodle version of the exercise. For structuring the content on the Moodle side the exsection meta-information can be used, see boxhist for a worked example.
Finally, you can add arbitrary metainformation by using the exextra tag. This is used, for example, in the essayreg exercise template. However, there is no general way of using this extra metainformation to insert additional XML code in the exams2moodle() output. To do that, the source code underlying exams2moodle() would have to be adapted correspondingly.

Creating two blogs on same website (Jekyll GitHub) without altering layout/formatting

I have recently tried creating a website using the Jekyll GitHub template here. One major alteration I hope to make to this template is to have two "blogs" in the format provided in the Blog tab of that template specifically shown here.
I (sort of) successfully created two blogs in my website and named the associated tabs (Media) and (Blog). I achieved this by reorganizing the file structure to have a "media" folder and a "blog" folder separately that each contain a _posts folder and index.html file. Now, when I add .md files in the _posts folder, these posts seem to get added to the correct tab (Media or Blog).
Even though that functionality works, both the Blog and Media tab lost their aesthetics compared to the style in the original template blog. Namely, 1) the banner image at the top is now gone; 2) the text formatting with the title in one line followed by the date in the "pretty" format (gray colored and in the format 29 Aug 2016) is now in a less-attractive bullet format with date first and in the format Aug 29, 2016; 3) the introductory excerpt text (in the example: "A pot still is a type of still used in distilling spirits such as whisky or brandy. Heat is applied directly to the pot containing the wash (for whisky) or wine (for brandy).") is now gone.
It is unclear to me why my separation of the _posts folder into two separate folders seems to cause these unwanted layout side effects. Since all three of these layout issues changed at once, I am assuming they can all be solved in the same solution. Whether or not that is true, any advice on how to solve these layout issues could be very helpful. Thank you for sharing any ideas!
You've removed the posts collection from your _config.yml which was setting the default feature_image for all posts. Unless you add that back in or include the overrides in each individual post it will not display the header (it may or may not also affect the rest of the styles):
collections:
media:
title: Media # Needed for Siteleaf
output: true
description: "Recent discussions with the media." # The post list page content
feature_text: |
Sharing our motivations and
opinions with the media.
feature_image: "https://picsum.photos/2560/600?image=866"
You're not actually using a media collection in either blog/index.html nor media/index.html, you're using the post.categories for filtering in the end, which will still causes some weird pagination once you start getting things rolling.
You may want to look at using the separate collections and then pre-building your site using paginator v2 (https://github.com/sverrirs/jekyll-paginate-v2/blob/master/README-GENERATOR.md) which will allow for pagination of different collections.
Edit 2020-01-23
Taking a new look at your repository, you still only have one (posts) collection. Therefore the logic for reading feature_* is being shared. If you look at the include site_feature.html you can see how the feature_image is being parsed out of the collections.
{% assign collectiondata = site.collections | where: "label", page.collectionpage | first %}
Which in your case is why Blog and Media both have the second image ?image=213. Your blog.html and media.html still have the front matter collectionpage: post.
I still think you're going down a slippery slope which will result in things not working exactly as you want them once you get more and more posts by doing it this way.

Merge JS files into one Adobe AEM

I have the following code to pull in two different categories but this outputs 6 separate files and I would like the output to be just one. How can this be done in AEM 6.0?
<clientlib data-sly-call="${clientLib.js # categories=['cq.foundation-main','cq.shared']}" data-sly-unwrap />
Thanks
In AEM, a category include will merge and compress all the files into a single js (or css) include. This is done per category include.
If you want to merge multiple categories, you should consider using the embed option in categories dependencies. How this works is:
Create a new category (for e.g. cq-embed)
Define embed dependencies ('cq.foundation-main','cq.shared') for the new category you have created.
Reference your new category.
You can also use this tool from ACS to optimise the includes:
https://adobe-consulting-services.github.io/acs-aem-tools/features/clientlibs-optimizer/index.html
It allows you to create the embed categories and reference them in a much cleaner way.

Appropriate design of DHTML / multipage CGI form

What is the standard method for implementing a "wizard" using successive web forms?
I'm implementing a CGI that accepts several options, files, etc. But some of these options have dependencies to one another, and allow or require other options to be used.
For example, one type of object that needs to be initialized by the CGI can be created using:
two files of type X
two strings
one file of type Y
In my command line version, I look whether two files of type X, two strings, or one file of type Y is provided, and construct the object in the appropriate manner.
In my CGI, I'd like to do this using multiple pages or DHTML (perhaps a radio button that specifies which arguments the user wishes to provide; changing the radio button will change the form to the right).
Anyway, I have this situation for 3 main groups of arguments. I thought it would be pleasing to the user to create a 6 "page" wizard (think online dating):
Page 1:
"How would you like to specify your proteins of interest?"
radio button:
Two FASTA files
Prefix and suffix strings that match all of my proteins (and match only my proteins)
A text file containing the proteins
Page 2:
"Great! Please choose your (either 'fasta files', 'prefix and suffix strings', or 'text file')."
(appropriate web form)
Unfortunately, if the form is split over different pages, I'm not sure how the 3rd, 4th, etc. pages will know the location of the temporary folder created for the uploaded files from pages 1 and 2.
I'd really appreciate your advice; I have a good command line app, but I am having a difficult time making beautiful interface code that will do what I want. And I'd be shocked if there isn't a very easy standard way to do this with Django or some other framework; it just seems it must come up very frequently.
There's a wizard plugin for jQuery.
http://plugins.jquery.com/project/formwizard
If you don't know jQuery, it is a javascript framework for doing DHTML.
Try the demo at http://thecodemine.org/

Customizing single entry templates in ExpressionEngine (1.6.x)

This is either very annoying or very embarrassing. I've set up most of my blog, but I can't figure out where or how the heck I set up single entry templates as opposed to the section/weblog containing them. I just can't find information on how to do it for the life of me.
This is especially important, because I want to define the canonical link for all entries, since ExpressionEngine links to entries in all kinds of ways.
So, the case is that I have a Blog section/weblog with an index working as the front page for mydomain.com. This lists all my entries as you would imagine a regular blog to do. The problem arises when I need to customize the code for the single entries' links.
If you have a template set up already which is showing a multitude of entries and you want a single entry page for each entry then what you need to do is this :
{exp:channel:entries
channel="default_site"
sort="asc"
disable="member_data|pagination|categories"}
{title}
{/exp:channel:entries}
Then in the template shown above by template_group/template_name (please change those to whatever your template group and template names actually are ;-) ) you will place this code :
{exp:channel:entries
channel="default_site"
limit="1"
dynamic="yes"
sort="asc"
disable="member_data|pagination|categories"}
{title}
{/exp:channel:entries}
This will then show you just the one entry as you will have used the {url_title_path="template_group/template_name"} in the first channel entries tag above which would basically create a URI something like this :
http://www.example.com/template_group/template_name/url_title_of_my_posted_entry
On the second (template_group/template_name) single entry template page it will see the URL title and use this to filter down the channel entries tag to just that one entry.
Hope that helps a bit.
Best wishes,