title: Can I conditionally render partial views in _Layout.cshtml?
body: <p>Suppose I have a _Layout.cshtml where I render a left sidebar, which is common to every page of my website.
  Something along these lines - a menu, for example</p>
  
  <pre><code>&lt;div id="left-sidebar"&gt;
      @Html.Action("_MenuView", "LeftSideMenu")
  &lt;/div&gt;
  </code></pre>
  
  <p>A feature I would like to have would be to add another partial view, but only display it in certain sections of the website.</p>
  
  <p>For example, in the blog section I may want to display a list of post categories or a treeview of the posts.</p>
  
  <pre><code>&lt;div id="left-sidebar"&gt;
      @Html.Action("_MenuView", "LeftSideMenu")
  
      @if ("???")
      {
          @Html.Action("_BlogTreeView", "BlogEntries")
      }
  &lt;/div&gt;
  </code></pre>
  
  <p>How could I do that? I know that I want to display "_BlogTreeView" if the view I'm rendering is returned by BlogController ... where do I go from there?</p>