Skip to content

Commit

Permalink
Adjust sorting by slug
Browse files Browse the repository at this point in the history
  • Loading branch information
jespermhl committed Jul 24, 2024
1 parent f20270e commit 576aa83
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
7 changes: 5 additions & 2 deletions compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def generate_card(title, date, path, author, snippet, image):

def generate_more_pages(pages, types):
"""
Generates the 'More' pages for each type.
Generates the 'More' pages for each type, sorted by slug (title).
"""
def generate_list_item(title, date, path, author, snippet):
return f"""
Expand All @@ -243,9 +243,12 @@ def generate_list_item(title, date, path, author, snippet):

for path_key, section_title in types.items():
more_page_content = f"<h1>{section_title}</h1><div class='list-group mb-3'>"

# Filter and sort pages
filtered_pages = [info for page, info in sorted(pages.items(), key=lambda x: x[1]['date'], reverse=True) if path_key in info['path']]
sorted_pages = sorted(filtered_pages, key=lambda x: x['title'].lower()) # Sort by title (slug)

for info in filtered_pages:
for info in sorted_pages:
file_path = os.path.join(CONTENT_DIR, info['path'].replace('.html', '.md'))
with open(file_path, 'r') as f:
markdown_text = f.read()
Expand Down
24 changes: 12 additions & 12 deletions dist/more/updates.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,9 @@
<div class="container mt-4" style="padding-top: 5em;">
<h1>Updates</h1><div class='list-group mb-3'>
<div class="list-group-item">
<h5 class="mb-1"><a href="updates/update_2024-05-28.html">Update May 28, 2024</a></h5>
<small class="text-muted">Posted on May 28, 2024 by Jesper</small>
<p class="mb-1">The Sims Team just published a new update! These are the key fixes: Dishes won't hide anymore; they'll be cleaned...</p>
</div>

<div class="list-group-item">
<h5 class="mb-1"><a href="updates/update_2024-06-06.html">Update June 6, 2024</a></h5>
<small class="text-muted">Posted on June 6, 2024 by Jesper</small>
<p class="mb-1">This is a rather small update which primarily removes the bugs where you could get the items from the login...</p>
<h5 class="mb-1"><a href="updates/update_2024-04-16.html">Update April 16, 2024</a></h5>
<small class="text-muted">Posted on April 16, 2024 by Jesper</small>
<p class="mb-1">These are the key fixes in the Update from April 16, 2024. Base Game: Alive plants will no longer emit...</p>
</div>

<div class="list-group-item">
Expand All @@ -63,9 +57,15 @@ <h5 class="mb-1"><a href="updates/update_2024-07-24.html">Update July 24, 2024</
</div>

<div class="list-group-item">
<h5 class="mb-1"><a href="updates/update_2024-04-16.html">Update April 16, 2024</a></h5>
<small class="text-muted">Posted on April 16, 2024 by Jesper</small>
<p class="mb-1">These are the key fixes in the Update from April 16, 2024. Base Game: Alive plants will no longer emit...</p>
<h5 class="mb-1"><a href="updates/update_2024-06-06.html">Update June 6, 2024</a></h5>
<small class="text-muted">Posted on June 6, 2024 by Jesper</small>
<p class="mb-1">This is a rather small update which primarily removes the bugs where you could get the items from the login...</p>
</div>

<div class="list-group-item">
<h5 class="mb-1"><a href="updates/update_2024-05-28.html">Update May 28, 2024</a></h5>
<small class="text-muted">Posted on May 28, 2024 by Jesper</small>
<p class="mb-1">The Sims Team just published a new update! These are the key fixes: Dishes won't hide anymore; they'll be cleaned...</p>
</div>
</div>
</div>
Expand Down

0 comments on commit 576aa83

Please sign in to comment.