Browse Source

show new pages and updates on homepage. add date to 3d printer articles.

Thomas Buck 2 years ago
parent
commit
a5c14b1a15

+ 1
- 1
input/index.md View File

@@ -35,7 +35,7 @@ All of my projects are released as free or open-source software on [my Gitea Ser
35 35
 
36 36
 To receive my latest updates, you can subscribe to the <a href="rss.xml"><img src="img/rss.png">RSS Feed</a>.
37 37
 
38
-### Recent Posts
38
+### Recent Posts and Updates
39 39
 
40 40
 <!--%
41 41
 printRecentMenu()

+ 2
- 0
input/projects/3d-printing/ctc-i3.md View File

@@ -2,6 +2,8 @@ title: CTC i3 Pro B
2 2
 description: Experiences with and modifications to my chinese Prusa i3 clone
3 3
 parent: 3d-printing
4 4
 position: 20
5
+date: 2017-11-01
6
+update: 2022-01-27
5 7
 comments: true
6 8
 ---
7 9
 

+ 2
- 0
input/projects/3d-printing/fabrikator-mini.md View File

@@ -2,6 +2,8 @@ title: Fabrikator Mini
2 2
 description: My modifications for the TinyBoy Fabrikator Mini
3 3
 parent: 3d-printing
4 4
 position: 10
5
+date: 2016-03-01
6
+update: 2022-01-27
5 7
 comments: true
6 8
 ---
7 9
 

+ 2
- 0
input/projects/3d-printing/octoprint.md View File

@@ -2,6 +2,8 @@ title: OctoPrint Setup
2 2
 description: Setting up OctoPrint and some common improvements
3 3
 parent: 3d-printing
4 4
 position: 40
5
+date: 2019-09-08
6
+update: 2022-01-24
5 7
 comments: true
6 8
 ---
7 9
 

+ 2
- 2
macros.py View File

@@ -101,7 +101,7 @@ def printMenuItem(p, yearsAsHeading = False, showDateSpan = False, showOnlyStart
101 101
                 dateto = " (%s - %s)" % (year, p.get("update", "")[0:4])
102 102
 
103 103
         if nicelyFormatFullDate:
104
-            dateto = " - " + datetime.strptime(p.date, "%Y-%m-%d").strftime("%B %d, %Y")
104
+            dateto = " - " + datetime.strptime(p.get("update", p.date), "%Y-%m-%d").strftime("%B %d, %Y")
105 105
 
106 106
     print "  * **[%s](%s)**%s" % (title, p.url, dateto)
107 107
 
@@ -116,7 +116,7 @@ def printMenuItem(p, yearsAsHeading = False, showDateSpan = False, showOnlyStart
116 116
 
117 117
 def printRecentMenu(count = 5):
118 118
     posts = [p for p in pages if "date" in p]
119
-    posts.sort(key=lambda p: p.get("date"), reverse=True)
119
+    posts.sort(key=lambda p: p.get("update", p.get("date")), reverse=True)
120 120
     for p in posts[0:count]:
121 121
         printMenuItem(p, False, False, False, True)
122 122
 

Loading…
Cancel
Save