Posts by marktaylor

    Hi,


    Is there a way to add the blog post except as the meta description in the <head>. I've tried using the Open Graph tags but to no avail.


    PHP
    1. <meta name="description" content="<?php perch_blog_post_field(perch_get('s'), 'excerpt'); ?>" />

    This outputs the excerpt but includes the <p> tags around it.


    Thanks in advance.

    Hi,


    I have a generic 'Archive' page with the below title, however this is being marked down for SEO as many of the 'pages' have the same title. Is it possible to dynamically insert the category or tag returned.


    This is how it is : <title>Archive | <?php echo $companyName ;?></title>

    Ideally I'd like this if possible: <title>Archive of (Tag/Category) | <?php echo $companyName ;?></title>



    I output the returned queries using the below, if it in anyway helps.


    Thanks in advance.


    Thanks, that's perfect!!


    How do I expand the range of filtering? Is there a list of options available (ie postTitle, postDescHTML)


    I'd like to include the main content, tags and categories.


    Also is there a way to include similar matches? As when I search tree, only items with 'tree' appear, the items with 'trees' do not.


    Thanks

    Sorry, this has confused me. I've tried replacing search with blog and it's not worked.


    This is my output search results page:


    This is blog_search_results.php


    PHP
    1. <?php
    2. perch_blog_custom([
    3. 'template' => 'post_search_result',
    4. 'filter' => 'postURL',
    5. 'value' => perch_layout_var('url', true),
    6. ]);
    7. ?>


    and this search-result.html


    Any help much appreciated.

    Hi Clive, thanks for pointing me to this article. I've managed to implement this but have run into a couple of issues...


    1. I can't seem to change the order of the results - I've tried adding sort order but it doesn't seem to work.

    2. The search returns 23 results, however I've filtered to show 9, but when clicking through to pages 2 and 3, no results are shown.


    I don't suppose you can help?


    Thanks

    I've just come across another issue. When there are multiple pages of results (I currently have the count at 9), no results show on the other pages, however it is saying there are 3 pages. Here is my code.


    Hi,


    I've managed to successfully implement this, however I can't seem to change the order of the search results. I'd like the latest to show first, but it shows the oldest first. I've tried adding the 'sort-order'=>'DESC' however this doesn't seem to work.


    Any help much appreciated.


    Thanks

    Hi Clive, that works great thanks.


    I'm trying to style the search results as per my post listings but have hit a wall with some bits. I can't seem to pull in the post image, post date or control the length of the excerpt. I've managed to get the button and heading to style but can't seem to control the bits mentioned. I've posted the code below, any help/direction is much appreciated.



    Thanks

    Hi Clive,


    This is my search form template


    <perch:form id="search" method="get">

    <div>

    <!-- <perch:label for="q">Search</perch:label> -->

    <perch:input type="search" id="q" />

    <perch:input type="submit" value="Go" />

    </div>

    </perch:form>


    Any help much appreicated.


    Thanks

    Hi,


    I'm trying to implement a search bar on main news page, which is working, however the general news posts are still listed below the search results. Is there a way to open the results in a new page or have the general posts hidden so just the search results show?


    This is my code so far...


    <?php perch_search_form(); ?>


    <?php perch_content_search(perch_get('q'), [

    'template' => 'search-result.html',

    'count'=>9

    ]); ?>


    <div class="row">

    <?php perch_blog_recent_posts(9); ?>

    </div>



    Thanks

    Turns out I had removed these 2 lines from the post.html


    <perch:blog id="excerpt" type="textarea" label="Excerpt" markdown="true" order="3" suppress="true" size="s" />

    <perch:blog id="image" type="image" width="50" height="50" crop="true" suppress="true" />


    What does the second line do/mean?


    Sorry to ask a dumb question, quite new to Perch.

    I cannot seem to update post excerpts on existing posts, and for new posts no excerpts show up. I have the latest version installed but cannot see why it is not showing. Code is below - any help much appreciated. Thanks



    <div class="col-md-6 col-lg-4 mb-5 news-card">

    <perch:if exists="image">

    <a href="<perch:blog id="postURL" />" > <img src="<perch:blog id="image" type="image"/>" class="img-fluid" alt="<perch:blog id="postTitle" />" />

    </a></perch:if>

    <div class="outer">

    <div class="entry-published date"><i class="far fa-calendar-alt"></i><perch:blog id="postDateTime" format="j M Y" /></div>

    <h3><a href="<perch:blog id="postURL" />" class="entry-title"><perch:blog id="postTitle" /></a></h3>

    <div class="description entry-summary">

    <perch:blog id="excerpt" type="textarea" textile="true" chars="125" append="..." />

    </div>

    </div>

    <a href="<perch:blog id="postURL" />" class="btn-main btn-block"><span>Read more</span></a>

    </div>

    Hi,


    I'm trying to pull the category(ies) that the current post is in. The issue I have is that I want the categories to be displayed 'Published in 'Cat 1', 'Cat 2'' where if there is multiple categories it is displayed next to the current with a comma separating. If it has a single category, it doesn't print a comma. Currently, it prints:


    Published in 'Cat 1'


    Published in 'Cat 2'


    My code is below with the template


    <?php perch_blog_post_categories(perch_get('s')); ?>


    post_category_link.html:


    <p>Published in <a href="archive.php?cat=<perch:category id="catSlug" />"><perch:category id="catTitle" /></a></p>


    Hope this makes sense.


    Thanks,