0

Say I have the following URLs for my Channel entry page:

http://site.com/used-toys/231/
http://site.com/new-toys/235/

NOTE: the pattern is: template_group/entry_id

They use the same Channel and display the exactly the same thing. The URLs are different for SEO purposes. What should I do so that I can remain DRY in respect to the markup that display these Channel entries.

The non-DRY way to do this is to just make sure that used-toys/index is kept in sync with new-toys/index.

Stash is probably a solution, but I have struggled with that the moment I start doing complex things where parse order matters. I'm hoping for an easier, native-EE solution.

2 Answers 2

4

If you are talking about, reusing the same template format, in multiple templates, then technically that is what {embeds} can be used for. To do this, we would do…

Template Group: used-toys/index
     {embed="include/toy-display"}

then

Template Group: new-toys/index
     {embed="include/toy-display"}

then have a single template that is used by both or any template, you wish the same display style for.

Template Group: include/toy-display
     {embed="include/header"}
     <div class="toy">
         your display details.
     </div>
     {embed="include/footer"}
3
  • Or just put {embed="used-toys/index"} directly inside new-toys/index, the separate "include" template isn't really necessary for something this simple. Commented Feb 6, 2013 at 8:39
  • 1
    We typically use embeds or snippets for the <html><head /> portion of the page, the header+nav, and the footer, across the entire site. As nonprofit_tech said, embed templates are designed for DRY, so you can store functionality in 1 location, and pass in embed:variables to match the current context. Commented Feb 6, 2013 at 14:20
  • @AdrianMacneil True. Just habit. We use a fair number of embeds or morsels, and find, that if their aren't too many, a single area is nice. If their are a lot, we do section/template_group specific placement. But we also try to do more universal templates, so a list_view vs product_listing, so they can get reused a lot. Commented Feb 6, 2013 at 16:29
0

You should not do this. It's going to harm your SEO more than it will improve it. Google will penalize you for having duplicate content, an generally only display one version of the content in its search results.

If you want to improve SEO for lots of different terms, you need to write good content for each term. Each page should have a single canonical URL where the content is accessible from. Simply displaying the same page in two different locations is misguided SEO.

5
  • It won't be duplicate content. I'm just categorizing the Channel entry pages, based on whether they are "new" or "used." New products will never appear under "used-toys"; used products will never appear under "new-toys". Commented Feb 6, 2013 at 6:14
  • Ohhh, I see. You just want to use the same template. In that case, if you want native EE a simple snippet or embed will do the trick. Commented Feb 6, 2013 at 8:38
  • Snippets are cheaper than embeds, right? What if the snippet has other snippets, conditions, embeds, etc.? Still OK? Parse order worry me. Commented Feb 6, 2013 at 8:41
  • 1
    Technically yes, but unless you are building a site for a very popular company the difference is negligible. Don't worry about parse order until you actually have a problem :) Most of the time it's not an issue. I would say snippets are better for using inside a channel entries loop (e.g. search result div), and embeds are better for whole pages/sidebars (since you have to explicitly pass variables through to an embed, whereas all variables exist in a snippet). Commented Feb 6, 2013 at 8:51
  • 2
    If you do find yourself in a position where you're replicating content across URLs, you can use <link rel="canonical" href="" /> to tell search engines where the canonical URL is. You should not be running a content farm, but we just launched a site where we have a number of localized websites sharing content found on the corporate site. If you store the canonical URL in each entry, you can automate outputting that tag. NSM Better Meta supports a Canonical URL field as well. Commented Feb 6, 2013 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.