To have site.pages or site.projects of template data in octopress? - octopress

In official jekyll doc: Template Data, we have site.posts for a reverse chronological list of all Posts. Can we have site.pages for a list of all Pages? Or, if we create some customized layout, like project, how to have site.projects for all Projects?

Related

Using Timber and Shopify, how can I add meta fields on the ajax mini cart of timber?

I’m using Timber in a Shopify theme.
I would look to add meta fields of the product on the cart.
Cart screenshot here
The metafields are showing on product i would like to show that on Ajax mini cart too. product page screenshot
js code here
Let me know if its possible.
Here are a few examples on how you may access a product's metafields.
In the cart page though, because you don't have a direct access to the product object, you should first get access to the product object via the [line_item][2] object to be able to access the metafields, example:
{% for item in cart.items %}
{{ item.product.metafields.key }}
{% endfor %}
And that should do the trick!

How to assign different Joomla template styles to a category and it contains articles?

How to assign different Joomla template styles to a category and it contains articles, meaning that articles and categories use different style templates and layouts。
just like:
Category A contains many A articles. This category uses the website template protostar, but the article I want to use beez3, is there a way to make a judgment to change the layout? Or directly assign different style templates?
Joomla tends to be menu driven so you can create a Category Blog or Single Article menu option (page) or similar and then assign the required template style to each page in the template options.
Page classes can also be specified for menu options (pages) so that you can apply custom CSS to particular pages.

Processwire Holder/Page implementation

How do you implement a holder/page pattern in Processwire. The idea is simple. One page type manages the list view, and usually contains very little native content. The primary function of this page is to provide a list of its child pages, providing a brief summary for each one, along with a link to its detail view. A second page type will represent the detail view for any given child page, which will typically have a custom template and content fields that make up its identity. Think of it think like a news listings, image galleries, even a Twitter timeline.
I can give examples for two different methods from a recent site I built with Processwire.
First is NEWS section:
I have a page called News and it's template is news-listing. Under News, I have news pages and their template is news-detail. news-listing template only accepts news-detail and news-listing for child pages. I allowed news-listing under news-listing if client needs to create sub listing pages under news.
News-listing template basically gets the news with
<?php $news = $page->children('template=news-detail'); ?>
Second is Products section
Site has different section for purposes. Like WOMENS, MENS, KIDS etc. The products are not shared among those main separation. I have a structure like below
MAIN SEPARATION
Products (products are listed under)
Categories (categories are listed under)
On product details page you can select multiple categories. On categories page products are listed like this. And on main separation page I have categories listed. Each of these page type has their own templates.
$products = $page->rootParent->find("template=product-detail,category={$page->id}");
Hope it helps
Just create pages under parent page then iterate on children pages. Processwire is slow though, better use Silverstripe it's more responsive.

Sort shopping cart by collection in Shopfiy

Sorry in advance for the Shopify question:
I am trying to finish a store for my friend and he needs the shopping cart to sort the items by what Collection they are in. This is a menu for fresh food delivered daily and each collection is a day, so I am trying to display the cart by Monday, Tuesday, etc. I think I have an idea of how to do this in liquid, but am new to Shopify and liquid, so please forgive me.
I think the two routes could be by using product.collections (which returns a list of all collections that an item is part of), or by using tags on each item and using product.tags to return that tag.
Then by using these I can display them appropriately on the page.
UPDATE:
I have most of the logic there, I just can't seem to put the labels in correctly now.
{% for item in cart.items %}
{%if item.product.tags contains 'Monday' %}
This displays what I need as far as the items in the right order, my problem now is getting only 1 title or h4 to appear for each category.
Any help would be greatly appreciated.
Nevermind, all I had to do was add a table head with the tag name above each of:
{% for item in cart.items %}
{%if item.product.tags contains 'Monday' %}
Everything came out wonderfully!

should schema rich snippet use for product listing too?

I'm implementing schema rich snippet to a Magento store for Product page, and would like to know if it's a good idea to also do it for Product listing page.
Did a search and most questions/articles are focus on Product page only, so I am wondering if it maybe counter productive for SEO purpose.
Thanks!
As far as Google is concerned, product rich snippets aren't supported in product listings:
Use markup for a specific product, not a category or list of products.
See Google Rich snippets - Products
Search Engine Journal offers some good advice that more specifically answers your question though:
Depending on how the website is set up, you may choose to mark up
category pages. If you list product information on the category pages,
you will want to omit any microdata markup as it may cause a
confliction with the product pages. After all, the goal for
conversions usually starts with the product pages, so you will want
the product page to be the landing page rather than a category page.
For a simple category page that lists category names, place each
category name in an h1 tag and add the following microdata markup.
See E-Commerce Microdata Best Practices under the Category Page Markup heading.
Their reccomendation, and it seems a good one, is to add markup to your product list template somewhat like this:
<ul id="category_list">
<li itemscope itemtype="http://schema.org/Enumeration">
<img src="http://url.to.image" itemprop="image" />
<h1 itemprop="name">Category Name</h1>
</li>
</ul>

Resources