ASP Classic blog framework - BrainOrdure
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

132 lignes
5.4KB

  1. <%
  2. Dim featuredPost, homePostIter, homePostItem, homeHeroBackground, homePublishedText, homeReadTime, homeCardImage
  3. homeHeroBackground = ""
  4. Set homePostIter = posts.Iterator()
  5. If posts.Count > 0 Then
  6. Set featuredPost = homePostIter.GetNext()
  7. homeHeroBackground = ExtractFirstImageSrc(featuredPost.Body)
  8. End If
  9. %>
  10. <header class="masthead masthead-home<% If Len(homeHeroBackground) > 0 Then %> masthead-has-image<% End If %>"<% If Len(homeHeroBackground) > 0 Then %> style="background-image: url('<%= H(homeHeroBackground) %>')"<% End If %>>
  11. <div class="overlay"></div>
  12. <div class="container">
  13. <div class="row">
  14. <div class="col-lg-8 col-md-10 mx-auto">
  15. <div class="page-heading text-center">
  16. <h1>BrainOrdure</h1>
  17. <span class="subheading">A cleaner front page for essays, notes, and reader discussion.</span>
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. </header>
  23. <div class="row gy-4">
  24. <div class="col-lg-8">
  25. <% If posts.Count = 0 Then %>
  26. <div class="alert alert-secondary">No published posts are available yet.</div>
  27. <% Else %>
  28. <div class="card shadow-sm post-card post-card-featured mb-4">
  29. <% If Len(homeHeroBackground) > 0 Then %>
  30. <a class="post-card-image" href="<%= PostUrl(featuredPost.Slug) %>" style="background-image: url('<%= H(homeHeroBackground) %>')"></a>
  31. <% End If %>
  32. <div class="card-body">
  33. <div class="magazine-label mb-3">Featured story</div>
  34. <h2 class="post-title"><a href="<%= PostUrl(featuredPost.Slug) %>"><%= H(featuredPost.Title) %></a></h2>
  35. <p class="post-subtitle"><%= H(featuredPost.Summary) %></p>
  36. <%
  37. homePublishedText = ""
  38. If IsDate(featuredPost.PublishedDate) Then
  39. If CDate(featuredPost.PublishedDate) > #1/1/1970# Then
  40. homePublishedText = FormatDateTime(featuredPost.PublishedDate, vbLongDate)
  41. End If
  42. End If
  43. homeReadTime = EstimateReadTime(featuredPost.Body)
  44. %>
  45. <div class="post-meta-inline">
  46. <span>By BrainOrdure</span>
  47. <% If Len(homePublishedText) > 0 Then %><span class="meta-sep">•</span><span><%= H(homePublishedText) %></span><% End If %>
  48. <% If Len(homeReadTime) > 0 Then %><span class="meta-sep">•</span><span><%= H(homeReadTime) %></span><% End If %>
  49. </div>
  50. </div>
  51. </div>
  52. <h2 class="h4 mb-3">Latest stories</h2>
  53. <%
  54. Dim homePreviewCount
  55. homePreviewCount = 0
  56. Do While homePostIter.HasNext And homePreviewCount < 4
  57. Set homePostItem = homePostIter.GetNext()
  58. homePreviewCount = homePreviewCount + 1
  59. homePublishedText = ""
  60. If IsDate(homePostItem.PublishedDate) Then
  61. If CDate(homePostItem.PublishedDate) > #1/1/1970# Then
  62. homePublishedText = FormatDateTime(homePostItem.PublishedDate, vbLongDate)
  63. End If
  64. End If
  65. homeReadTime = EstimateReadTime(homePostItem.Body)
  66. homeCardImage = ExtractFirstImageSrc(homePostItem.Body)
  67. %>
  68. <article class="card shadow-sm post-card mb-4">
  69. <% If Len(homeCardImage) > 0 Then %>
  70. <a class="post-card-image" href="<%= PostUrl(homePostItem.Slug) %>" style="background-image: url('<%= H(homeCardImage) %>')"></a>
  71. <% End If %>
  72. <div class="card-body">
  73. <div class="eyebrow mb-2">Issue <%= homePreviewCount + 1 %></div>
  74. <h3 class="post-title h4"><a href="<%= PostUrl(homePostItem.Slug) %>"><%= H(homePostItem.Title) %></a></h3>
  75. <p class="post-subtitle mb-2"><%= H(homePostItem.Summary) %></p>
  76. <div class="post-meta-inline">
  77. <span>By BrainOrdure</span>
  78. <% If Len(homePublishedText) > 0 Then %><span class="meta-sep">•</span><span><%= H(homePublishedText) %></span><% End If %>
  79. <% If Len(homeReadTime) > 0 Then %><span class="meta-sep">•</span><span><%= H(homeReadTime) %></span><% End If %>
  80. </div>
  81. </div>
  82. </article>
  83. <%
  84. Loop
  85. %>
  86. <div class="clearfix mb-5">
  87. <a class="btn btn-primary float-end" href="<%= PostsUrl() %>">View All Posts &rarr;</a>
  88. </div>
  89. <% End If %>
  90. </div>
  91. <div class="col-lg-4">
  92. <aside class="story-aside">
  93. <div class="card shadow-sm">
  94. <div class="card-body">
  95. <div class="magazine-label mb-3">Inside this issue</div>
  96. <h2 class="h4">Browse by section</h2>
  97. <div class="topic-chip-grid mt-3">
  98. <%
  99. Dim homeCategoryIter, homeCategoryItem
  100. Set homeCategoryIter = categories.Iterator()
  101. If categories.Count = 0 Then
  102. %>
  103. <span class="text-muted small">No categories yet.</span>
  104. <%
  105. Else
  106. Do While homeCategoryIter.HasNext
  107. Set homeCategoryItem = homeCategoryIter.GetNext()
  108. %>
  109. <a class="topic-chip" href="<%= CategoryUrl(homeCategoryItem.CategoryID) %>"><%= H(homeCategoryItem.Name) %></a>
  110. <%
  111. Loop
  112. End If
  113. %>
  114. </div>
  115. </div>
  116. </div>
  117. <div class="card shadow-sm">
  118. <div class="card-body">
  119. <div class="magazine-label mb-3">About</div>
  120. <p class="mb-0 text-muted">BrainOrdure is now styled like a modern editorial blog with cleaner reading flow, stronger story hierarchy, and better navigation.</p>
  121. </div>
  122. </div>
  123. </aside>
  124. </div>
  125. </div>

Powered by TurnKey Linux.