Create basic scripts to generate JSONs from images
This commit is contained in:
		
							parent
							
								
									2782838276
								
							
						
					
					
						commit
						9d9182e268
					
				| @ -1,5 +1,5 @@ | ||||
| +++ | ||||
| title = '{{ replace .File.ContentBaseName "-" " " | title }}' | ||||
| date = {{ .Date }} | ||||
| draft = true | ||||
| +++ | ||||
| --- | ||||
| title: '{{ replace .File.ContentBaseName "-" " " | title }}' | ||||
| date: {{ .Date }} | ||||
| draft: true | ||||
| --- | ||||
|  | ||||
							
								
								
									
										23
									
								
								hugo.toml
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								hugo.toml
									
									
									
									
									
								
							| @ -1,23 +0,0 @@ | ||||
| baseURL = 'https://example.org/' | ||||
| languageCode = 'en-US' | ||||
| title = 'My New Hugo Site' | ||||
| 
 | ||||
| [[menus.main]] | ||||
| name = 'Home' | ||||
| pageRef = '/' | ||||
| weight = 10 | ||||
| 
 | ||||
| [[menus.main]] | ||||
| name = 'Posts' | ||||
| pageRef = '/posts' | ||||
| weight = 20 | ||||
| 
 | ||||
| [[menus.main]] | ||||
| name = 'Tags' | ||||
| pageRef = '/tags' | ||||
| weight = 30 | ||||
| 
 | ||||
| [module] | ||||
|   [module.hugoVersion] | ||||
|     extended = false | ||||
|     min = "0.116.0" | ||||
							
								
								
									
										28
									
								
								hugo.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								hugo.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | ||||
| # baseURL = 'https://example.org/' | ||||
| # languageCode = 'en-US' | ||||
| # title = 'My New Hugo Site' | ||||
| 
 | ||||
| # [[menus.main]] | ||||
| # name = 'Home' | ||||
| # pageRef = '/' | ||||
| # weight = 10 | ||||
| 
 | ||||
| # [[menus.main]] | ||||
| # name = 'Posts' | ||||
| # pageRef = '/posts' | ||||
| # weight = 20 | ||||
| 
 | ||||
| # [[menus.main]] | ||||
| # name = 'Tags' | ||||
| # pageRef = '/tags' | ||||
| # weight = 30 | ||||
| 
 | ||||
| module: | ||||
|   hugoVersion: | ||||
|     extended: false | ||||
|     min: "0.116.0" | ||||
| 
 | ||||
| outputs: | ||||
|   section: | ||||
|     - html | ||||
|     - json | ||||
							
								
								
									
										3
									
								
								layouts/albums/baseof.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								layouts/albums/baseof.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | ||||
| { | ||||
|     {{- block "main" . }}{{ end -}} | ||||
| } | ||||
							
								
								
									
										4
									
								
								layouts/albums/list.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								layouts/albums/list.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | ||||
| { | ||||
|     "images": [{{ partial "albums/images.json" . }}], | ||||
|     "albums": [{{ partial "albums/albums.json" . }}] | ||||
| } | ||||
							
								
								
									
										15
									
								
								layouts/partials/albums/albums.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								layouts/partials/albums/albums.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | ||||
| {{- $first := true -}} | ||||
| {{- range .Pages.ByTitle -}} | ||||
| {{- if not $first }}, {{ end }} | ||||
| {{ $first = false -}} | ||||
| { | ||||
|     "title": "{{ .Title }}", | ||||
| {{- with .Resources.GetMatch "album.zip" }} | ||||
|     "albumDownload": "{{ .RelPermalink }}", | ||||
| {{ else -}} | ||||
| {{ warnf "Could not find album.zip for %s" .RelPermalink -}} | ||||
| {{ end -}} | ||||
|     "images": [{{ partial "albums/images.json" . }}], | ||||
|     "albums": [{{ partial "albums/albums.json" . }}] | ||||
| } | ||||
| {{ end -}} | ||||
							
								
								
									
										12
									
								
								layouts/partials/albums/images.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								layouts/partials/albums/images.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | ||||
| {{- $first := true -}} | ||||
| {{- range .Resources.ByType "image" -}} | ||||
| {{- if not $first }}, {{ end }} | ||||
| {{ $first = false -}} | ||||
| { | ||||
|     "title": "{{ .Title }}", | ||||
|     "url": "{{ .RelPermalink }}", | ||||
|     "width": "{{ .Width }}", | ||||
|     "height": "{{ .Height }}", | ||||
|     "thumbnail": "{{ (.Fit "200x200").RelPermalink }}" | ||||
| } | ||||
| {{ end -}}   | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user