| 
									
										
										
										
											2025-08-15 03:09:58 +02:00
										 |  |  | {{- /* | 
					
						
							|  |  |  | A shortcode to create a badge. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @param {string} content The content of the badge. | 
					
						
							| 
									
										
										
										
											2025-08-23 15:42:23 +02:00
										 |  |  | @param {string} color The color of the badge. | 
					
						
							| 
									
										
										
										
											2025-08-15 03:09:58 +02:00
										 |  |  | @param {string} class The class of the badge. | 
					
						
							|  |  |  | @param {string} link The link of the badge. | 
					
						
							|  |  |  | @param {string} icon The icon of the badge. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | or | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @param {string} 0 The content of the badge. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-23 15:42:23 +02:00
										 |  |  | @example {{< badge content="Badge" color="blue" >}} | 
					
						
							|  |  |  | @example {{< badge "Badge" >}} | 
					
						
							| 
									
										
										
										
											2025-08-15 03:09:58 +02:00
										 |  |  | */ -}} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-22 22:12:22 +01:00
										 |  |  | {{- if .IsNamedParams -}} | 
					
						
							|  |  |  |   {{- $content := .Get "content" -}} | 
					
						
							| 
									
										
										
										
											2025-08-23 15:42:23 +02:00
										 |  |  |   {{- $color := .Get "color" | default (.Get "type") | default "" -}}{{- /* Compatibility with previous parameter. */ -}} | 
					
						
							| 
									
										
										
										
											2024-09-22 22:12:22 +01:00
										 |  |  |   {{- $class := .Get "class" | default "" -}} | 
					
						
							|  |  |  |   {{- $link := .Get "link" | default "" -}} | 
					
						
							| 
									
										
										
										
											2024-12-28 13:50:22 +00:00
										 |  |  |   {{- $icon := .Get "icon" | default "" -}} | 
					
						
							| 
									
										
										
										
											2025-08-23 15:42:23 +02:00
										 |  |  |   {{- $border := not (eq (.Get "border") false) | default true }} | 
					
						
							| 
									
										
										
										
											2024-09-22 22:12:22 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   {{- if $link -}} | 
					
						
							|  |  |  |     <a href="{{ $link }}" title="{{ $content | plainify }}" target="_blank"> | 
					
						
							|  |  |  |       {{- partial "shortcodes/badge.html" (dict | 
					
						
							|  |  |  |         "content" $content  | 
					
						
							| 
									
										
										
										
											2025-08-23 15:42:23 +02:00
										 |  |  |         "color" $color | 
					
						
							| 
									
										
										
										
											2024-09-22 22:12:22 +01:00
										 |  |  |         "class" $class | 
					
						
							| 
									
										
										
										
											2025-08-23 15:42:23 +02:00
										 |  |  |         "border" $border | 
					
						
							| 
									
										
										
										
											2024-12-28 13:50:22 +00:00
										 |  |  |         "icon" $icon | 
					
						
							| 
									
										
										
										
											2024-09-22 22:12:22 +01:00
										 |  |  |         ) | 
					
						
							|  |  |  |       -}} | 
					
						
							|  |  |  |     </a> | 
					
						
							|  |  |  |   {{- else -}} | 
					
						
							|  |  |  |     {{- partial "shortcodes/badge.html" (dict | 
					
						
							|  |  |  |       "content" $content  | 
					
						
							| 
									
										
										
										
											2025-08-23 15:42:23 +02:00
										 |  |  |       "color" $color | 
					
						
							| 
									
										
										
										
											2024-09-22 22:12:22 +01:00
										 |  |  |       "class" $class | 
					
						
							| 
									
										
										
										
											2025-08-23 15:42:23 +02:00
										 |  |  |       "border" $border | 
					
						
							| 
									
										
										
										
											2024-12-28 13:50:22 +00:00
										 |  |  |       "icon" $icon | 
					
						
							| 
									
										
										
										
											2024-09-22 22:12:22 +01:00
										 |  |  |       ) | 
					
						
							|  |  |  |     -}} | 
					
						
							|  |  |  |   {{- end -}} | 
					
						
							|  |  |  | {{- else -}} | 
					
						
							|  |  |  |   {{- $content := .Get 0 -}} | 
					
						
							|  |  |  |   {{- partial "shortcodes/badge.html" (dict | 
					
						
							|  |  |  |     "content" $content  | 
					
						
							|  |  |  |     "border" true | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  |   -}} | 
					
						
							|  |  |  | {{- end -}} |