<%@ Reference VirtualPath="~/bitrix/components/bitrix/blog/component.ascx" %>
<%@ Control Language="C#" Inherits="Bitrix.Blog.Components.BlogTemplate" %>

<bx:IncludeComponent 
	ID="menu" 
	runat="server" 
	ComponentName="bitrix:blog.menu" 
	Template=".default"
	ThemeCssFilePath="" 
	ColorCssFilePath="" 
			
	NewPostUrlTemplate="<%$ Results:NewPostUrlTemplate %>" 
	UserBlogUrlTemplate="<%$ Results:PostListUrlTemplate %>" 
	UserBlogSettingsUrlTemplate="<%$ Results:BlogEditUrlTemplate %>" 
	BlogIndexUrl="<%$ Results:IndexUrlTemplate %>" 
	UserProfileUrlTemplate="<%$ Results:UserProfileUrlTemplate %>"
	DraftPostListUrlTemplate="<%$ Results:DraftPostListUrlTemplate%>"
/>

<bx:IncludeComponent 
	ID="blog"
	runat="server" 
	ComponentName="bitrix:blog.post.list" 
	Template=".default"
	ThemeCssFilePath="" 
	ColorCssFilePath="" 
	Publishmode="<%$ Results:PublishMode %>" 
	BlogUrlTemplate="<%$ Results:PostListUrlTemplate %>" 
	UserProfileUrlTemplate="<%$ Results:UserProfileUrlTemplate %>" 
	PostViewUrlTemplate="<%$ Results:PostUrlTemplate %>" 
	PostEditUrlTemplate="<%$ Results:PostEditUrlTemplate %>"
	PagingRecordsPerPage="<%$ Results:PostsPerPage %>" 
	PagingPageID="<%$ Results:PageId %>" 
	PagingIndexTemplate="<%$ Results:PagingIndexTemplate %>" 
	PagingPageTemplate="<%$ Results:PagingPageTemplate %>" 
	BlogSlug="<%$ Results:BlogSlug %>" 
/>

<%@ Reference VirtualPath="~/bitrix/components/bitrix/blog.post.list/component.ascx" %>
<%@ Import Namespace="Bitrix.Blog.Components" %>
<%@ Import Namespace="Bitrix.DataTypes" %>
<% 
	BlogPostListComponent component = blog.Component as BlogPostListComponent;
	if (component != null && component.Posts.Count < 1 &&
		component.FatalError == BlogPostListComponent.ErrorCode.None &&
		component.PostPublishMode == BlogPostListComponent.PublishMode.Published && 
		!component.IsFilterSet && component.IsOwner)
	{ 
		BXParamsBag<object> replace = new BXParamsBag<object>();
		replace["BlogSlug"] = Results["BlogSlug"];
	%>
	<br /><a href="<%= component.Encode(component.ResolveTemplateUrl((string)Results["NewPostUrlTemplate"], replace)) %>"><%= GetMessage("CreateFirstPost") %></a>.
<%} %>