I’m trying to set up a blogging system for about six to eight of our authors. My requirements are as follows:
1.) “Master” blog page, where recent posts from every blogger will show
2.) “Individual” blog page, where each author’s own posts will show
3.) “Single-View” page, where an individual post will be displayed
4.) To keep short, semantic URLs, #1 above is located at /blogs/, #2 is at /blogs/username/, and #3 is at /blogs/username/post-title
Sadly, I can’t get the comment form to show with more than two segments in the URL.
Here’s my relevant code:
{if segment_2 == ""}
{!-- Blogs homepage: <a href="http://example.com/blogs/">http://example.com/blogs/</a> --}
<h1>Recent Posts:</h1>
{exp:channel:entries channel="{pre_channel}" limit="20" disable="categories|member_data"}
<h2 class="column"><span><a href="/blogs/{username}/{url_title}">{title}</a><span></h2>
<div>
<i>Posted by {author} on {entry_date format="%F %d, %Y"}</i>
{blurb}<a href="/blogs/{username}/{url_title}">Read Post</a>
</div>
{/exp:channel:entries}
{/if}
{if segment_2 != "" AND segment_3 == ""}
{!-- Individual Blog: <a href="http://example.com/blogs/username/">http://example.com/blogs/username/</a> --}
{exp:channel:entries channel="{pre_channel}" username="{segment_2}" limit="20" disable="categories|member_data"}
<h2 class="column"><span><a href="/blogs/{username}/{url_title}">{title}</a><span></h2>
<div>
<i>Posted by {author} on {entry_date format="%F %d, %Y"}</i>
{blurb}<a href="/blogs/{username}/{url_title}">Read Post</a>
</div>
{/exp:channel:entries}
{/if}
{if segment_3 != ""}
{!-- Individual Post: <a href="http://example.com/blogs/username/post-title-goes-here">http://example.com/blogs/username/post-title-goes-here</a> --}
{exp:channel:entries channel="{pre_channel}" url_title="{segment_3}" limit="1" disable="categories|pagination|member_data"}
<div>
<h1>{title}</h1>
<i>By {author}, {entry_date format="%F %d, %Y"}</i>
<div>{blog_post}</div>
</div>
{snp_comment_form}
{/exp:channel:entries}
{/if}The comment form will not appear when viewing the single-entry page. If I change the final {if} statement to check for segment_2 instead and remove the /username/ segment of the URL, then it works. I know this is definitely a workable thing to set up, but I really need the semantic and organized “feel” of having each user’s posts categorized under their own “directory.”
Thanks for any ideas,
Matthew