broadfield-dev commited on
Commit
4ba2523
·
verified ·
1 Parent(s): adfeb4f

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +3 -3
templates/index.html CHANGED
@@ -20,7 +20,7 @@
20
  .search-button { padding: 10px 20px; border: none; border-radius: 25px; background-color: #3498db; color: white; cursor: pointer; font-size: 1em; }
21
  .search-button:hover { background-color: #2980b9; }
22
  .category-section { margin: 20px 0; }
23
- .category-title { background-color: #3498db; color: white; padding: 10px; border-radius: 5px; cursor: pointer; user-select: none; }
24
  .tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; margin-top: 15px; }
25
  .article-tile {
26
  background: white;
@@ -81,7 +81,7 @@
81
  <div class="sidebar">
82
  <h3>Categories</h3>
83
  <ul>
84
- {% for category in categories %}
85
  <li onclick="showCategory('{{ category }}')" id="sidebar-{{ category }}">{{ category }}</li>
86
  {% endfor %}
87
  </ul>
@@ -118,7 +118,7 @@
118
 
119
  document.addEventListener('DOMContentLoaded', () => {
120
  const storedCategory = sessionStorage.getItem('currentCategory');
121
- if (storedCategory) {
122
  showCategory(storedCategory);
123
  } else if (document.querySelector('.sidebar li')) {
124
  showCategory(document.querySelector('.sidebar li').textContent);
 
20
  .search-button { padding: 10px 20px; border: none; border-radius: 25px; background-color: #3498db; color: white; cursor: pointer; font-size: 1em; }
21
  .search-button:hover { background-color: #2980b9; }
22
  .category-section { margin: 20px 0; }
23
+ .category-title { background-color: #3498db; color: white; padding: 10px; border-radius: 5px; user-select: none; }
24
  .tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; margin-top: 15px; }
25
  .article-tile {
26
  background: white;
 
81
  <div class="sidebar">
82
  <h3>Categories</h3>
83
  <ul>
84
+ {% for category in categorized_articles.keys() %}
85
  <li onclick="showCategory('{{ category }}')" id="sidebar-{{ category }}">{{ category }}</li>
86
  {% endfor %}
87
  </ul>
 
118
 
119
  document.addEventListener('DOMContentLoaded', () => {
120
  const storedCategory = sessionStorage.getItem('currentCategory');
121
+ if (storedCategory && document.getElementById(`sidebar-${storedCategory}`)) {
122
  showCategory(storedCategory);
123
  } else if (document.querySelector('.sidebar li')) {
124
  showCategory(document.querySelector('.sidebar li').textContent);