mirror of
				https://github.com/tiyn/beaker-blog.git
				synced 2025-11-04 04:41:15 +01:00 
			
		
		
		
	adding dates to archive
This commit is contained in:
		
							
								
								
									
										17
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								README.md
									
									
									
									
									
								
							@@ -5,18 +5,21 @@ This is a simple blog based on Pythons Flask framework.
 | 
				
			|||||||
## Features/To-Dos
 | 
					## Features/To-Dos
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- [x] Plain text support for blog entries
 | 
					- [x] Plain text support for blog entries
 | 
				
			||||||
  - [x] HTML files (.html)
 | 
					    - [x] HTML files (.html)
 | 
				
			||||||
  - [x] Markdown Files (.md)
 | 
					    - [x] Markdown Files (.md)
 | 
				
			||||||
- [x] Infinite-scroll blog page
 | 
					- [x] Infinite-scroll blog page
 | 
				
			||||||
- [x] Archive page
 | 
					- [x] Archive page
 | 
				
			||||||
  - [ ] Months as headings
 | 
					    - [x] Months as headings
 | 
				
			||||||
 | 
					    - [x] Links to scrolling blog page
 | 
				
			||||||
 | 
					    - [ ] Links to standalone article
 | 
				
			||||||
 | 
					- [ ] Standalone article page
 | 
				
			||||||
- [x] RSS feed
 | 
					- [x] RSS feed
 | 
				
			||||||
- [ ] Better navigation
 | 
					- [ ] Better navigation
 | 
				
			||||||
  - [ ] Header
 | 
					    - [ ] Header
 | 
				
			||||||
  - [ ] Footer
 | 
					    - [ ] Footer
 | 
				
			||||||
- [ ] Switchable CSS
 | 
					- [ ] Switchable CSS
 | 
				
			||||||
  - [ ] CSS dark-theme
 | 
					    - [ ] CSS dark-theme
 | 
				
			||||||
  - [ ] CSS light-theme
 | 
					    - [ ] CSS light-theme
 | 
				
			||||||
- [x] Docker installation
 | 
					- [x] Docker installation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Usage
 | 
					## Usage
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,12 +17,19 @@ def gen_arch_string():
 | 
				
			|||||||
        full_list = [os.path.join(path_ex, i) for i in name_list]
 | 
					        full_list = [os.path.join(path_ex, i) for i in name_list]
 | 
				
			||||||
        contents = sorted(full_list, key=os.path.getctime)
 | 
					        contents = sorted(full_list, key=os.path.getctime)
 | 
				
			||||||
        content_string = ''
 | 
					        content_string = ''
 | 
				
			||||||
 | 
					        last_month = ''
 | 
				
			||||||
        for file in reversed(contents):
 | 
					        for file in reversed(contents):
 | 
				
			||||||
 | 
					            curr_date = datetime.fromtimestamp(os.path.getctime(file)).strftime('%Y-%m-%d')
 | 
				
			||||||
 | 
					            curr_month = datetime.fromtimestamp(os.path.getctime(file)).strftime('%b %Y')
 | 
				
			||||||
 | 
					            if curr_month != last_month:
 | 
				
			||||||
 | 
					                content_string += '<h2>' + curr_month + '</h2>'
 | 
				
			||||||
 | 
					                last_month = curr_month
 | 
				
			||||||
            filename = pathlib.PurePath(file)
 | 
					            filename = pathlib.PurePath(file)
 | 
				
			||||||
            title = open(filename).readline().rstrip('\n')
 | 
					            title = open(filename).readline().rstrip('\n')
 | 
				
			||||||
            filename = filename.name
 | 
					            filename = filename.name
 | 
				
			||||||
            if filename[0] != '.':
 | 
					            if filename[0] != '.':
 | 
				
			||||||
                filename = filename.split('.', 1)[0]
 | 
					                filename = filename.split('.', 1)[0]
 | 
				
			||||||
 | 
					            content_string += curr_date + ' - '
 | 
				
			||||||
            content_string += '<a href="' + '/index.html#' + \
 | 
					            content_string += '<a href="' + '/index.html#' + \
 | 
				
			||||||
                filename + '">' + title + '</a><br>\n'
 | 
					                filename + '">' + title + '</a><br>\n'
 | 
				
			||||||
        return content_string
 | 
					        return content_string
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user