Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
I have a blog which is organized in dynamic folders to categorize the different posts.

I had actually never thought about giving dedicated descriptions to the list views of every folder,
which I did now using the folder description.

So I am using
Code: Select all
<cms:show k_folder_title />
and
Code: Select all
<cms:excerpt count='155'><cms:show k_folder_desc /></cms:excerpt>
within the meta descriptions of every list that displays a particular folder content. -> http://example.com/blog/folder-a/

The problem now at top level, i.e. http://example.com/blog/ is that this is not a folder and I need conditionally show another output:
Code: Select all
<cms:get_custom_field 'seo_title_blog' masterpage='globals.php' />
and
Code: Select all
<cms:get_custom_field 'seo_description_blog' masterpage='globals.php' />


Can I implement this via if-else statements? I am working on the code in blog_list.html.
Hi, @JD

If /blog is not a folder, then is is a template (clonable).
For templates we can use "views".
When you visit /blog/ it is not a page view, not a folder view, it is a home/list view.
Then simple conditional will do the job:
<cms:if k_is_home >
.. show meta description..
</cms:if>
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Thanks for your response.

The working code looks like this:

Code: Select all
<cms:if k_is_home ><cms:get_custom_field 'seo_title_blog' masterpage='globals.php' /><cms:else />Blog | <cms:show k_folder_title /></cms:if>


Code: Select all
<cms:if k_is_home ><cms:get_custom_field 'seo_description_blog' masterpage='globals.php' /><cms:else /><cms:excerpt count='155'><cms:show k_folder_desc /></cms:excerpt></cms:if>
You may also want to include the page view For single pages - <cms:if k_is_page> Else the folder tag will be displayed for them (and it probably won't find them, so will be empty meta tags)
Image
4 posts Page 1 of 1