title: How to make Jekyll excerpts work with Jupyter Notebooks
body: <p>I have a github.io blog that contains both text (Markdown) and Jupyter Notebook posts. The Jupyter Notebook posts are converted to HTML using nbconvert. This works well but the index page has an except section that doesn't work with the HTML notebooks. For the Markdown posts, it pulls in an excerpt from each post onto the index page, but not for the HTML ones. I would like to be able to include an excerpt, such as the first cell of Markdown, as an except on the index page.  I'm trying to find a solution that's both functional and looks good.</p>
  
  <p>The blog is a fork from <a href="https://github.com/barryclark/jekyll-now" rel="nofollow noreferrer">Barry Clark's Jekyll Now template</a>. </p>
  
  <p>I tried using strip_html like so:</p>
  
  <pre><code>    &lt;div class="entry"&gt;
          {{ post.excerpt | strip_html | truncatewords: 50}}
      &lt;/div&gt;
  </code></pre>
  
  <p>but then it includes the front matter like the date and title, kind of like this:</p>
  
  <h1>Example blog</h1>
  
  <h3>2017-9-6-Example-blog This is my example!</h3>
  
  <p>where I would like it to look like:</p>
  
  <h1>Example blog</h1>
  
  <h3>This is my example!</h3>
  
  <p>I also tried writing a piece of code that added a description to each Jupyter Notebook HTML by injecting something like this into each file:</p>
  
  <pre><code>&lt;font size="5"&gt;&lt;description&gt;This is my example!&lt;/description&gt;&lt;/font size="5"&gt;
  </code></pre>
  
  <p>This worked for the index page but then each blog post has "This is my example" at the top of the page which looks completely different than the Jupyter Notebook format. This isn't an elegant solution anyway but if there were an HTML tag that the index would pick up (without using strip_html) but wouldn't show in the post, it would suffice.</p>
  
  <p>I also tried converting the Jupyter Notebook straight to Markdown, but the formatting doesn't look at good as the HTML conversion and the input/output of the code blocks is lost.</p>