Posts by dosa

    I have a blog and when I show the posts like this:

    PHP
    1. <?php
    2. perch_blog_custom([
    3. 'count' => 6,
    4. 'sort' => 'postDateTime',
    5. 'template' => 'blog/post_in_column.html',
    6. 'sort-order' => 'DESC',
    7. 'paginate' => true,
    8. ]); ?>

    But when I edit a post, the post, no matter what the publish date, it brings the post to the top since it was last edited. Is there a way to sort by the publish date instead?

    Thanks however this is specifically for an older site migrated from Nov 2019. I'd want the history from then - so i imagine nothing was logging it even on the perch backend?

    I'm not seeing the pagination appear in a list of blog posts. The code:

    PHP
    1. <?php
    2. perch_blog_custom([
    3. 'count' => 60,
    4. 'sort' => 'postDateTime',
    5. 'template' => 'blog/post_in_column.html',
    6. 'sort-order' => 'DESC',
    7. 'paginate' => true,
    8. ]); ?>
    9. <perch:template path="pagination/default.html" rescope="parent">

    Sure thing. So the post.html gives the users an options to choose an "Industry" from a dropdown menu. This dropdown provides the title of the industry in the proper format. For example: Insurance (capitalized)


    But I'm using the same dropdown to set the class of the DIV, so I'm using URLify to set that as well. So it's format is then class="insurance".


    This works just as I expect here:

    PHP
    1. <?php perch_blog_custom([
    2. 'sort' => 'postDateTime',
    3. 'template' => 'blog/post_in_column.html',
    4. 'sort-order' => 'DESC',
    5. 'filter' => 'industry',
    6. 'match'=>'eq',
    7. 'value'=>'insurance',
    8. ]); ?>

    But 2 options in drop down menu have an ampersand. For example: Energy & Utilities. But the URLify'd version doesn't seem to want to filter. I assume this is because of the dash.

    PHP
    1. <?php perch_blog_custom([
    2. 'sort' => 'postDateTime',
    3. 'template' => 'blog/post_in_column.html',
    4. 'sort-order' => 'DESC',
    5. 'filter' => 'industry',
    6. 'match'=>'eq',
    7. 'value'=>'energy-utilities',
    8. // with the dash, this filter doesn't work. So can URLify use an underscore instead?
    9. ]); ?>

    This is from an old post Simon post a couple years ago. I don't see an answer though. I'm currently using 'urlify' to generate a filter. There are two names that have an &, so the 'urlify' changes it to a dash. But I think the perch_blog_custom has an issue displaying a 'value' with a dash in it.


    So - is there a way to urlify but with underscores instead of dashes? Code snippet please?

    Thanks @clive - yes, it might be confusing at first, but I am letting the CMS editors create the tags (instead of displaying all of them) so they can control the "most popular" tags and prioritize what they want. So the perch:content is in a shared region. But the key is the linking.


    I thought it was working, but it actually is not. :( The page is blank using the post.php as its base.

    Sorry, but I mean a history of changes on my own CMS. Each page change. Ideally, a page link list with dates of changes. Then I can compare which pages I need to update in my migration (bunch of reasons I am doing it this way).

    Right. As you can see, my code is almost identical, but missing the tagSlug. That is because the CMS user will be adding the slug.


    But that just made me realize I think I have the link wrong. Now I tried it without the /archive.php and it worked! I don't know what template it's using to display the results, so I am hunting for that now. Looks to be using post.php ....but I'd rather have a custom template page for "tag searches" like this. Do you know what that is called?

    On Perch 2 vs Perch 3, I noticed blog details for "Tags" are now under the "Meta and Social" tab.


    I'm making a tag cloud of those tags linking to a search for articles with those tags. I can't find a Perch resource that shows the syntax for linking to this type of search. Right now, I'm doing this:

    Code
    1. <a href="/about/newsroom/archive.php?tag=<perch:content id="text" type="text" label="Tag" title="true" help="Enter the tag exactly, without spaces. Case sensitive." />" rel="tag" class="tag" ><perch:content id="text" type="text" label="Tag" help="Enter the tag exactly, without spaces. Case sensitive." /></a>


    Of course that leads to a 404 page. What did I miss?

    Sorry for my reply delay. It's showing just one result for a search that has many results. Even though the first result is correct. Am I missing count or another option?


    PHP
    1. <?php
    2. perch_content_search(perch_get('q'), [
    3. 'apps' => ['PerchBlog'],
    4. 'count'=>1000,
    5. 'template'=>'search-result.html',
    6. 'from-path' => '/newsroom',
    7. ]);
    8. ?>