Skip to content

Commit

Permalink
fix: Generate h2 tag only when subtitle exists
Browse files Browse the repository at this point in the history
  • Loading branch information
parksb committed Sep 20, 2020
1 parent c7cf9fa commit 7c1916d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
8 changes: 5 additions & 3 deletions app/templates/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
<h1 id="article-title">
<%- article.title %>
</h1>
<h2 id="article-subtitle">
<%- article.subtitle %>
</h2>
<% if (article.subtitle) { %>
<h2 id="article-subtitle">
<%- article.subtitle %>
</h2>
<% } %>
<time id="article-date">
<%- article.date %>
</time>
Expand Down
28 changes: 15 additions & 13 deletions app/templates/articles.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,20 @@
<section id="articles-container">
<ul>
<% articles.reverse().map((article) => { %>
<li id="articles-list-item">
<a href="./article/<%= article.id %>.html">
<h1><%= article.title %></h1>
<h2><%= article.subtitle %></h2>
<time><%= article.date %></time>
<ul class="articles-tags">
<% article.tags.map((tag) => { %>
<li>#<%= tag.trim() %></li>
<% }) %>
</ul>
</a>
</li>
<li id="articles-list-item">
<a href="./article/<%= article.id %>.html">
<h1><%= article.title %></h1>
<% if (article.subtitle) { %>
<h2><%= article.subtitle %></h2>
<% } %>
<time><%= article.date %></time>
<ul class="articles-tags">
<% article.tags.map((tag) => { %>
<li>#<%= tag.trim() %></li>
<% }) %>
</ul>
</a>
</li>
<% }) %>
</ul>
</section>
Expand All @@ -41,4 +43,4 @@
<script defer src="../src/ts/init.ts"></script>
</body>

</html>
</html>

0 comments on commit 7c1916d

Please sign in to comment.