ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Weblog question

July 25, 2010 8:54am

Subscribe [3]
  • #1 / Jul 25, 2010 8:54am

    Ramya108

    123 posts

    I am quite new to Expression Engine and it looks like I have made a mistake while implementing weblogs.

    I have built my website blog in the following way:

    This page contains list of blog entries, including blog title, summary and a link to the full blog:
    http://www.alternativa-za-vas.com/index.php/clanak/blog

    The full blog entry can be reached by clicking on its link, or by choosing an article in the list of categories, which are in the right column.

    I published all of my blogs in the /clanak/article/ template, by adding a weblog title, full text and comment tags.

    Everything seemed to work perfectly, until I started seeing this page in the Search Engine results:

    http://www.alternativa-za-vas.com/index.php/clanak/article/

    On this page you can see the endless list of all of my weblog entries, one after another. Not only that, searh engines somehow started to index non-existing pages, but all leading to the same page with endless entries. For example, I have never created this page:

    http://www.alternativa-za-vas.com/index.php/clanak/article/citrofit.html

    but it got indexed by the search engines and now appears in the search results!

    This is a mess!!! Please help me!

  • #2 / Jul 25, 2010 11:32am

    Boyink!

    5011 posts

    I think you just need to add some 404 handling.

    First - start by creating a 404 template - something to show when the request isn’t valid.

    Then on Strict URLs and specify the 404 template in
    http://expressionengine.com/legacy_docs/cp/templates/global_template_preferences.html

    Then - add 404 logic to the single entry (article) template by adding the require_entry=“yes” to the weblog:entries tag.

    Then put a if no results conditional inside the tag.

    Then to the top of that same template - before any other code - add:

    {if segment_3 ==""}
      {redirect="404"}
    {/if}

    This should ensure that the articles template is only ever loaded in single entry form (with a url title in segment 3), and with a valid URL showing.

  • #3 / Jul 25, 2010 1:36pm

    Ramya108

    123 posts

    Wow! Thank you very much!

  • #4 / Jul 25, 2010 4:41pm

    Ramya108

    123 posts

    Tried to implement it and it does not work! I dont understand where the problem might be.

    1. Created a custom 404 page
    2. Enabled strict urls and added the custom page.
    3. Added requre_entry and no_results to the template
    4. Added this code: {if segment_3 ==""}
      {redirect="404"}
    {/if}

    Still not functioning and I do not know why. Here is my template:

    {if segment_3 ==""}
      {redirect="404"}
    {/if}  
    {embed="embeds/html_header" my_title="{exp:weblog:entries weblog="clanak"}{title}{/exp:weblog:entries}"}
    
    
    <body id="subpage">
    [removed][removed]
    
    <div class="wrap_all">
        <div id="top">
    
          <div id="head"> 
           {embed="embeds/logo_title"}
            {embed="embeds/main_nav"}    
               </div><!-- end head-->
            
            <div id="main">
    
                 
          <div id="content" class="bg_sidebar">
               <div id="inner_content">
                <div class="entry">
    
    
    
    {exp:hop_inject where="<p>"}
    {exp:weblog:entries weblog="clanak" require_entry=“yes”  limit="1" disable="categories|member_data|pagination|trackbacks"}
    {if no_results}
    {redirect="404"}
    {/if}    
    
     <h2>{title}</h2>
    
    <p>{exp:hop_inject:injection separator="3" position="before"}</p>
    
    <p><div>[removed]<!--<br />
    google_ad_client = "pub-2093185670253746";<br />
    google_ad_host = "pub-2606800903002383";<br />
    google_ad_width = 468;<br />
    google_ad_height = 60;<br />
    google_ad_format = "468x60_as";<br />
    google_ad_type = "text";<br />
    google_ad_channel = "";<br />
    google_color_border = "FFFFFF";<br />
    google_color_bg = "FFFFFF";<br />
    google_color_link = "0000FF";<br />
    google_color_text = "FFFFFF";<br />
    google_color_url = "FFFFFF";<br />
    google_ui_features = "rc:6";<br />
    //--> [removed] [removed] [removed] </div>  </p>
    
    <p><br />
    {/exp:hop_inject:injection}</p>
    
    <p><div class="entry-content"><div class="aligncenter"></div><br />
                <br />
    {body}   </p>
    
    <p>  </div><!--end entry-content--></p>
    
    <p><br />
      {/exp:weblog:entries} </p>
    
    <p>{/exp:hop_inject}</p>
    
    <p><br />
       <a href="http://{path=clanak/blog}">Povratak na Blog</a>    </p>
    
    <p> </p>
    
    <p> </p>
    
    <p> </p>
    
    <p> </p>
    
    <p>{exp:comment:entries sort="asc" limit="0"}<br />
    <div class="entry-content"></p>
    
    <h6>Komentar</h6>
    <p></div></p><blockquote>
    <p> <br />
    {comment}</p>
    
    </blockquote>
    <p><span class="comments">By {name} on {comment_date format="%d.%m.%Y"}</span></p>
    
    <p><br />
    {/exp:comment:entries}</p>
    
    
    
    <p> </p>
    
    <p> </p>
    
    <h4>Komentiraj</h4>
    
    <p> </p>
    
    <p>{exp:comment:form weblog="clanak" preview="clanak/comment_preview"}</p>
    
    <p>{if logged_out}</p>
    
    <p>Ime:     <input type="text" name="name" value="{name}" size="20" /></p></p>
    
    <p>E-mail: <input type="text" name="email" value="{email}" size="20" /></p></p>
    
    <p><br />
    {/if}</p>
    
    <p><br />
    <textarea name="comment" cols="52" rows="13">{comment}</textarea><br />
    <a path='site/smilies'>Smajlići</a></p>
    
    <p><input type="checkbox" name="save_info" value="yes" {save_info} /> Zapamti me!</p>
    
    <p><input type="checkbox" name="notify_me" value="yes" {notify_me} /> Primaj obavijesti o novim komentarima</p>
    
    <p>{if captcha}</p>
    
    <p>Molim Vas, ispod upišite znakove, koje vidite na slici:</p>
    
    <p>{captcha}</p>
    
    <p><input type="text" name="captcha" value="{captcha_word}" maxlength="20" /></p></p>
    
    <p>{/if}</p>
    
    <p><input type="submit" name="submit" value="Pošalji" /><br />
    <input type="submit" name="preview" value="Pregled" /></p>
    
    <p>{/exp:comment:form}</p>
    
    <p><br />
                           <br />
                </div><!--end entry--><br />
                <br />
            <br />
        <br />
               </div><!-- end inner_content--></p>
    
    <p>           <br />
               {embed="embeds/sidebar1"}<br />
                    <br />
                <br />
              <br />
              </div><!-- end content-->   <br />
                     <br />
      </div><!--end main--><br />
            <br />
            <br />
    {embed="embeds/footer"}</p>
    
    <p>        <br />
        </div><!--end top--><br />
    </div><!--end wrapp_all--></p>
    
    <p></body></p>
    
    <p></html>

  • #5 / Jul 25, 2010 5:32pm

    Ramya108

    123 posts

    Ok, what I achieved is that when I try to reach http://www.alternativa-za-vas.com/index.php/clanak/article/ page I get my custom 404 page. This is good.

    However, when some wrong url is typed, I still get my http://www.alternativa-za-vas.com/index.php/clanak/article/ page.

    How can I set some redirect for the wrong url in the section 3?

  • #6 / Jul 25, 2010 5:46pm

    Boyink!

    5011 posts

    The only thing I see that might be wrong is the quotes around require_entry=“yes”.  Make sure they are straight quotes and not smart quotes.

  • #7 / Jul 25, 2010 6:42pm

    Ramya108

    123 posts

    Uh! You were right!

    I changed the quotes and now everything works like a charm.

    Thank you very much for your help and for your TrainEE site, which I was using to learn EE!  😊  😊 😊

  • #8 / Jul 25, 2010 6:55pm

    Boyink!

    5011 posts

    Cool..get lucky once in a while…;)

    Thanks for the comments on Train-ee - it’s always good to know the site is useful.

  • #9 / Jul 26, 2010 2:03am

    John Henry Donovan

    12339 posts

    Glad Mike was able to help. Closing this one out. Feel free to start a new thread if you have any more questions.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases