How to create Eleventy collection in code - eleventy

I'd like to create collections based on logic other than 'tags' frontmatter:
We use frontmatter to mark our articles with a status. I'd like to use this to provide collections for all the different statuses. Then I can easily show all posts 'in review' for example.
We have a yearly review policy, so I'd like a nightly build to pick up all articles within a month of this review date and add them to another collection.
So, is there a way to programmatically create a collection in 11ty?
Thanks

Sometimes I must be word blind...
I've found the answer in the docs:
module.exports = function(eleventyConfig) {
// Filter source file names using a glob
eleventyConfig.addCollection("posts", function(collectionApi) {
// Also accepts an array of globs!
return collectionApi.getFilteredByGlob(["posts/*.md", "notes/*.md"]);
});
};

In this article they have provided a great example of creating collection of unique categories, similar you can apply for status in your code. Please check if that helps.

Related

How to query stories without parent feature link?

In a given area path, I would to get the list of stories that does not have parent feature link. How should I write the query for it?
To achieve you could change the type of your query to the Work items and Direct Links query, then choose the option to pull back all work items without any matching links. The results will still be a flat list.
In the filters for top level work items, just add a filed to specify a detail area path and choose corresponding work item type.
More details please take a look at our official here: Use direct links to view dependencies
Hope this helps.

Is it possible to get all items using get_internal?

I have a need to be able to retrieve all items for a particular resource via a custom route. when I use the function as such get_internal("users", **{"role": item["_id"]}) I am only able to retrieve 50 users. Is there a way to tell get_internal to get all matching items? even if the number of items exceeds the PAGINATION_DEFAULT setting? Also is there any documentation on the <method>_internal functions?
Please see PAGINATION_LIMIT, PAGINATION_DEFAULT and QUERY_MAX_RESULTS. (Sorry, links only highlight the words in the page)

Umbraco Extending Tags

I am new to Umbraco CMS, so this question may sound silly. The requirement is to show the tags (based on a specific tag group) to editors in a dropbox, and they could able to choose these tags and save it to the article. What is the best way of achieving this?
The tag property allows free text entry. If you only want editors to select from a predefined list of options you will probably need to do this a different way. You may want to try the dropdown property with the multiple choice option turned on instead. Then you can setup the prevalues (options) ahead of time and your editors can only select from that list.
You could also create a container in the tree for your categories and then allow your admins to select the appropriate items from that list using a multinode tree picker. Here's kind of an example of how you might structure this for a blog:
Blog
Authors
Author
Categories
Category
Posts
Post
Then when an admin adds a new post you would allow them to select the appropriate authors/categories for the post using a multinode tree picker.

Alchemy CMS: Create element that contains list of elements

I'd like to create an element which can contain a list of items, where each item can have more than one essences.
For example:
The user should be able to add a "page listing" as content element. For each page item he should be able to upload a small image, a short description and a link. Because the list needs to be wrapped with an UL tag, I can't simply ask him to add a lot of elements.
Other example:
The user should be able to add a "team listing" as content element. Each member having a photo, a name, a job description and an email address. Same problem here: I'd like to have the team members wrapped within an DL tag.
Is there some way of releasing elements which can contain elements?
Some kind like: (just an example, might contain bugs)
- name: my_list_element
contents:
- name: list_style
type: EssenceSelect
- name: items
type: Element ???
elements: [my_item_element]
settings:
deletable: true
available_contents:
- name: items
type: Element ???
elements: [my_item_element]
settings:
deletable: true
- name: my_item_element
contents:
- name: image
type: EssencePicture
- name: headline
type: EssenceText
...
The inner item uses the default editor for pictures or text essences.
If someone knows a way how to realize this it would be very great, because it's the last puzzle part which is missing in order to use alchemy CMS :(
Thank you in advance
You want to use the new nestable Elements feature you'll find in the current master and soon to be released 3.3 version. Unfortunately they are not well documented yet. Sorry.
But it's really simple. Instead of the available_contents (That will be deprecated in favor of nested elements anyway, you list names of nestable_elements).
A nestable element can be any element you have defined.
Unless the guides got updated, please read the documentation in the code.
You may use http://ruby-doc.org/stdlib-2.1.0/libdoc/yaml/rdoc/YAML.html and get Hash in the output and also save it in text as well
Hope to see nestable_elements feature soon, may be it will solve some really obvious tasks. For now, without the possibility to easy extend Alchemy with custom models (Post, TeamMember, Testimonial, PortfolioItem, etc) I am still the fan on RefineryCMS or pure RoR, and this is sad, because AlchemyCMS has really nice things built-in.
As I can understand, this feature will be implemented in Alchemy 4 by Nodes, even the Page model will be registered as Alchemy::Node, and developer will be able to create own Nodes which will behave like custom_post_type in WordPress.

SharePoint - checking Content Approval change status in event receiver

I have a SharePoint list with Content Approval enabled. The business requirement is that once the new list item is approved it should stay approved despite further updates by any user.
My first thought was to handle the ItemUpdating method, and if the corresponding before property is Approved then set the after property to Approved. This doesn't work however.
In the ItemUpdating method the "Approval Status" column does not show up in properties.BeforeProperties or properties.AfterProperties. properties.ListItem["Approval Status"] and properties.ListItem.ModerationInformation.Status both show the "before" value. In the ItemUpdated method the situation is the same, except instead the values shown are the "after" values.
Is there a way in either method to identify both the before and after methods? I can work around this by creating a new hidden column that I set when the item is approved but that doesn't seem best.
Should I be approaching this from a workflow perspective?
Would this help?
http://www.synergyonline.com/blog/blog-moss/Lists/Posts/Post.aspx?ID=25
Use field's internal name with AfterProperties or BeforeProperties.
i.e. properties.AfterProperties["internal name"].
It works for me
Please refer to the following properties in the AfterProperties section for a document library.
Document libraries are a bit different than lists. the doc libraries have .AfterProperties["vti_doclibmodstat"] and .AfterProperties["vti_doclibmodcomm"].

Resources