Search Results Placement

Topics: Customizing Orchard, Troubleshooting, Writing themes
Nov 17, 2011 at 10:49 PM

Hi,

I'm trying to hide fields in search results via Placement.info file in my theme but it doesn't work.  It works for part.  In the below snippet the title will be surpressed but the taxonomy field will not. 

  <Match Path="/Search">
    <Place Fields_Contrib_TaxonomyField="-"/>
    <Place Parts_RoutableTitle_Summary="-"/>    
  </Match>
 
Any ideas?
        

  

                  

Nov 17, 2011 at 11:03 PM

You might want to look at Shape Tracing to check you're targeting the right part. Some shapes render different versions for different display modes. You're targeting the correct "Summary" shape for RoutableTitle, but it's possible Taxonomy has one too. Shape Tracing will tell you the correct names of the parts currently displaying.

Nov 17, 2011 at 11:14 PM

randompete,

I checked all that including the Shape Tracing and I don't see it as a different part.  Here's the content of the placement file for the Taxonomy module.  I don't see any indication of a different shape, do you?

<Placement>
  <!-- Location of field edition -->
  <Place Fields_Contrib_TaxonomyField_Edit="Sidebar:2.5"/>
  
  <!-- Display terms in front-end summaries -->
  <Match DisplayType="Summary">
    <Place Fields_Contrib_TaxonomyField="Content:after"/>
  </Match>

  <!-- Display terms in content item details -->
  <Match DisplayType="Detail">
    <Place Fields_Contrib_TaxonomyField="Content:5"/>
  </Match>

  <!-- Display terms in admin summaries -->
  <Match DisplayType="SummaryAdmin">
    <Place Fields_Contrib_TaxonomyField="Content:5"/>
  </Match>
  
  <!-- Display in admin -->
  <Place Parts_Taxonomies_Term_Fields="Content:2"/>
  
  <!-- Widget -->
  <Place Parts_Taxonomies_TermsWidget_Edit="Content:5"/>
  <Place Parts_Taxonomies_TaxonomyMenuItem_Edit="Content:5"/>
  <Place Parts_Taxonomies_TermsWidget="Content"/>  
</Placement>

Nov 17, 2011 at 11:39 PM

That all looks fine.

There's one thing you can try. This doesn't normally happen when your placement is in a theme, but it's worth a shot. Give your theme a dependency on Contrib.Taxonomy (in your Theme.txt manifest). What sometimes happens with modules is that Orchard doesn't know the order to process Placement files in, but by setting a dependency you can ensure that yours overrides the original. As far as I know themes should always take precedence, so it probably won't work, but it's worth checking before looking at anything else.