I have a Github Style calendar for my statistics page in my website. A calendar is created for every year and data is populated to the corresponding year. Whenever I save the partial corresponding to the calendar, the years get reversed.
The page template structure is the following:
.
├── content/
│ └── extra/
│ └── statistics.md
└── layouts/
├── _partials/
│ └── statistics/
│ ├── activity-overview.html
│ ├── cloc.html
│ ├── stat-tables.html
│ └── table-of-contents.html
└── extra/
└── statistics.html
The main template statistics.html is split in partials:
{{- define "main" }}
{{- $vars := dict
"sections" (or site.Params.statisticsSections site.MainSections)
"cloc_title" "Lines Of Code"
"cloc_file" "cloc.csv"
"aggr_title" "Aggregated Statistics"
"ov_title" "Activity Overview"
"sns_union_title" "All Sections"
"tag_limit" .Params.tag_limit
"calendar_style" .Params.calendar_style
"page" .
-}}
<h1>{{ .Title }}</h1>
{{ .Content }}
{{ partial "statistics/table-of-contents" $vars }}
{{ partial "statistics/activity-overview" $vars }}
{{ partial "statistics/stat-tables" $vars }}
{{ partial "statistics/cloc" $vars }}
{{- end -}}
The partial corresponding to the calendar is *statistics/activity-overview".
statistics/activity-overview.html (650+ lines)
{{- /*
Set a new scratch to contain all pages with the extra information of
"yearweek"(the week of the year [1,53]). This is done because Hugo does not
have a ".GroupBydate" method with "yearweeks". So what needs to be done to
group pages by "yearweek" is to go through all the pages while setting the
"yearweek" manually and then storing them in a scratchpad to later iterate
every relevant date.
NOTE: For some reason writing/saving this file will permutate the order of the
calendars. You can save the file once more to fix the order. If you have any
clue why that might happen please let me know.
*/ -}}
{{- $p := .page }}
{{- $ov_title := .ov_title }}
{{- $calendar_style := default "codeberg" .calendar_style }}
{{- $s := newScratch }}
{{- $s.Set "rawdata" slice }}
{{- $sns := .sections }}
{{- $pgs := where site.RegularPages "Section" "in" $sns }}
{{- $tot_mainsections := len $sns }}
{{- $angle := div (math.Mul math.Pi 2) $tot_mainsections }}
{{- $yrs := slice }}
{{- /*
Go through all pages to populate "rawdata" scratchpad with "year",
"yearweek", "weekday" and "date" of the pages. Also compensate for the real
start of the year.
*/ -}}
{{- range $pgs }}
{{- $yr := string .Date.Year }}
{{- $yr_start := printf "%s-01-01" $yr }}
{{- $yrs = append $yr $yrs }}
{{- $wkday := int .Date.Weekday }}
{{- with try (time.AsTime $yr_start) }}
{{- with .Err }}
{{- warnf "%s" . }}
{{- continue }}
{{- else}}
{{- $yr_start = .Value }}
{{- end }}
{{- end }}
{{- $yrweek := "" }}
{{- $yrweek_offset := add .Date.YearDay (int $yr_start.Weekday) }}
{{- with try (div (float $yrweek_offset) 7) }}
{{- with .Err }}
{{- warnf "%s" . }}
{{- continue }}
{{- else }}
{{- $yrweek = string (math.Ceil .Value) -}}
{{- end }}
{{- end }}
{{- $pg_data := dict
"year" $yr
"yearweek" $yrweek
"weekday" $wkday
"date" .Date
}}
{{- $s.Add "rawdata" $pg_data }}
{{- end -}}
{{- $empty_week := dict
"0" 0
"1" 0
"2" 0
"3" 0
"4" 0
"5" 0
"6" 0
-}}
{{- /*
Iterate through years > yearweeks > weekdays then set corresponding nested
maps in reverse order to populate "data" map.
*/ -}}
{{- $yrs := uniq $yrs }}
{{- $s.Set "data" dict }}
{{- range $yrs }}
{{- $yrweeks := slice }}
{{- $yr_pp := slice }}
{{- /* fill yearweeks map with empty weeks (defined before) */}}
{{- $s.Set "yearweeks" dict }}
{{- range seq 1 53 }}
{{- $s.SetInMap "yearweeks" (string . ) $empty_week }}
{{- end }}
{{- /* go through the pages of the current year and store them by yearweek */}}
{{- range where ($s.Get "rawdata") "year" . }}
{{- $yrweeks = append .yearweek $yrweeks }}
{{- $yr_pp = append . $yr_pp }}
{{- end -}}
{{- /* go through the pages by yearweek and store them by weekday */}}
{{- $yrweeks := uniq $yrweeks }}
{{- range $yrweeks }}
{{- $yrweek_pp := slice }}
{{- $s.Set "weekdays" dict }}
{{- /* get the pages of the current yearweek from the pages of the year */}}
{{- range where $yr_pp "yearweek" . }}
{{- $yrweek_pp = append . $yrweek_pp }}
{{- end -}}
{{- /* go through the pages by weekday and store the count of pages */}}
{{- range seq 0 6 }}
{{- $weekday_pp := slice }}
{{- range where $yrweek_pp "weekday" . }}
{{- $weekday_pp = append . $weekday_pp }}
{{- end }}
{{- $s.SetInMap "weekdays" (string . ) (len $weekday_pp) }}
{{- end }}
{{- /* populate current yearweek with corresponding weekdays */}}
{{- $s.SetInMap "yearweeks" (string . ) ($s.Get "weekdays") }}
{{- end -}}
{{- /* populate current year with corresponding yearweeks */}}
{{- $s.SetInMap "data" (string . ) ($s.Get "yearweeks") }}
{{- end -}}
{{- /* radar graph variables */}}
{{- $radar_width := 300 }}
{{- $polygon_opacity := "0.5" }}
{{- $polygon_fill := "" }}
{{- $line_stroke_color := "" }}
{{- /* calendar overview variables */}}
{{- $yr_sort := "desc" }}
{{- $calendar_width := 720 }}
{{- $stroke_width := 0.1 }}
{{- $offset_months_down := 2.1 }}
{{- $offset_grid_down := 3 }}
{{- $offset_grid_right := 5.5 }}
{{- $offset_weekdays_down := 1.2 }}
{{- $offset_weekdays_right := 1.1 }}
{{- $gaps_grid_inner := 1.79 }}
{{- $square_size := 1.2 }}
{{- $square_corner_radius := 0 }}
{{- $square_fill := safeCSS "light-dark(hsl(00 00 31), hsl(00 00 62))" }}
{{- $stroke_color := "light-dark(#1b1f240f, #0104090d)" }}
{{- $info_link := "https://codeberg.org/alecsargent/hugo-templates/src/branch/master/activity-overview" }}
{{- $palette0 := "" }}
{{- $palette1 := "" }}
{{- $palette2 := "" }}
{{- $palette3 := "" }}
{{- $palette4 := "" }}
{{- $palette5 := "" }}
{{- /* define main colors from page's theme parameter */}}
{{- with $calendar_style }}
{{- if (eq . "github") }}
{{- $palette0 = safeCSS "light-dark(#eff2f5, #151b23)" }}
{{- $palette1 = safeCSS "light-dark(#9be9a8, #033a16)" }}
{{- $palette2 = safeCSS "light-dark(#4ac26b, #196c2e)" }}
{{- $palette3 = safeCSS "light-dark(#30a14e, #2ea043)" }}
{{- $palette4 = safeCSS "light-dark(#216e39, #56d364)" }}
{{- $square_corner_radius = 0.15 }}
{{- $polygon_fill = "#40c463"}}
{{- $line_stroke_color = $palette4 }}
{{- else if (eq . "codeberg") }}
{{- $palette0 = safeCSS "light-dark(#d0d7de99, #08243799)" }}
{{- $palette1 = safeCSS "light-dark(#8db5dc, #14507d)" }}
{{- $palette2 = safeCSS "light-dark(#679cd0, #1a6aa6)" }}
{{- $palette3 = safeCSS "light-dark(#2185d0, #4793cc)" }}
{{- $palette4 = safeCSS "light-dark(#31699f, #59a4dc)" }}
{{- $palette5 = safeCSS "light-dark(#254f77, #90c2e8)" }}
{{- $polygon_fill = $palette2 }}
{{- $line_stroke_color = $palette3 }}
{{- else if (eq . "forgejo") }}
{{- $palette0 = safeCSS "light-dark(#e5e5e8, #232c37)" }}
{{- $palette1 = safeCSS "light-dark(#fdba74, #9a3412)" }}
{{- $palette2 = safeCSS "light-dark(#f97316, #ea580c)" }}
{{- $palette3 = safeCSS "light-dark(#c2410c, #fb923c)" }}
{{- $palette4 = safeCSS "light-dark(#9a3412, #fdba74)" }}
{{- $palette5 = safeCSS "light-dark(#7c2d12, #fed7aa)" }}
{{- $polygon_fill = $palette3 }}
{{- $line_stroke_color = $palette2 }}
{{- else if (eq . "gitlab") }}
{{- $palette0 = safeCSS "light-dark(#ececef, #28272d)" }}
{{- $palette1 = safeCSS "light-dark(#d2dcff, #303470)" }}
{{- $palette2 = safeCSS "light-dark(#7992f5, #4e65cd" }}
{{- $palette3 = safeCSS "light-dark(#4e65cd, #7992f5)" }}
{{- $palette4 = safeCSS "light-dark(#303470, #d2dcff)" }}
{{- $square_corner_radius = 0.20 }}
{{- $polygon_fill = $palette1 }}
{{- $line_stroke_color = $palette3 }}
{{- $gaps_grid_inner = 1.79 }}
{{- $square_size = 1.4 }}
{{- $offset_grid_right = 3.5 }}
{{- end }}
{{- end }}
{{- $palette := slice $palette0 $palette1 $palette2 $palette3 $palette4 }}
{{- if (in (slice "codeberg" "forgejo" "gitea") $calendar_style) }}
{{- $palette = append $palette5 $palette }}
{{- end }}
{{- $palette_len := len $palette }}
{{- /*
Define initial attributes for the rectangles in the calendar (days), the lines
and circles in the radar graph(axis and polygon vertices respectively).
*/}}
{{- $initial_rect_attrs := dict
"class" "day"
"width" $square_size
"height" $square_size
"stroke" $stroke_color
"stroke-width" $stroke_width
"rx" $square_corner_radius
-}}
{{- $initial_line_attrs := dict
"x1" "225"
"y1" "225"
"stroke" $line_stroke_color
"stroke-linecap" "round"
"stroke-width" "3.2"
-}}
{{- $initial_cir_attrs := dict
"r" "4"
"fill" "light-dark(white, black)"
"stroke" $line_stroke_color
"stroke-width" "3.2"
-}}
{{- $month_of_year := dict
"1" "Jan"
"2" "Feb"
"3" "Mar"
"4" "Apr"
"5" "May"
"6" "Jun"
"7" "Jul"
"8" "Aug"
"9" "Sep"
"10" "Oct"
"11" "Nov"
"12" "Dec"
}}
{{- $days_of_week := dict
"0" "Sun"
"1" "Mon"
"2" "Tue"
"3" "Wed"
"4" "Thu"
"5" "Fri"
"6" "Sat"
-}}
{{- /* tag overview variables */ -}}
{{- $tag_limit := default 10 .tag_limit -}}
{{- /*
Activity Calendar:
Go through "data" map recursively with years > yearweeks > weekdays. For every
year there make a svg, for every yearweek make a vertical group inside the
svg, and for every group make rectangles corresponding to the days of they
year and paint with color indicating the count of uploads of that day.
Tag Overview:
After generating the Activity Calendar but not after exiting the "year"
iteration the the "data" map we fetch the tags used of pages uploades within
that year.
Radar Chart:
Again, without exiting the "year" iteration we collect all pages from within
that year and group by section to compare them relatively.
NOTE:
Explicitly sorting a map makes first variable lose its value and inherit the
loop iteration value.
*/ -}}
{{ partial "utils/heading" (dict "heading" $ov_title "level" 2 )}}
{{- range $yr, $yrweek := sort ($s.Get "data") "value" $yr_sort }}
{{- $actual_year := index $yrs $yr | int }}
{{- $yr_start := "" }}
{{- with try (time.AsTime (printf "%d-01-01" $actual_year)) }}
{{- with .Err }}
{{- warnf "%s" . }}
{{- continue }}
{{- else}}
{{- $yr_start = .Value }}
{{- end }}
{{- end }}
{{- $yr_end := time.AsTime (printf "%d-12-31" $actual_year) }}
{{- $low_bound := where $pgs "Date" "ge" $yr_start }}
{{- $high_bound := where $pgs "Date" "le" $yr_end }}
{{- $intersect := intersect $low_bound $high_bound }}
{{- $yrly_uploads := "uploads" -}}
{{- $yrly_uploads_count := len $intersect -}}
{{- if eq 1 (len $intersect) -}}
{{- $yrly_uploads = singularize $yrly_uploads -}}
{{- end -}}
<a
class="no-text-decor total-uploads"
href="#{{ $actual_year }}">
<p id="{{ $actual_year }}" class="year-upload-count" >
{{ $yrly_uploads_count }} {{ $yrly_uploads }} on {{ $actual_year }}
</p>
</a>
<div class="activity_ov_wrap_out">
<div class="activity_ov_wrap">
<div class="calendar">
<svg viewBox="0 0 100 16" width="{{ $calendar_width }}">
{{- range $yrweek_num, $weekday := $yrweek }}
{{- $rect_attrs := $initial_rect_attrs }}
{{- $x := add
(math.Mul
$gaps_grid_inner
(sub (int $yrweek_num) 1 )
)
$offset_grid_right
}}
<g transform="translate({{ $x }}, 0)">
{{- range $weekday_num, $count := $weekday }}
{{- /* skip day if it is not in real year */}}
{{- $est_yearday := int
(add
(mul
(sub (float $yrweek_num) 1 )
7
)
(int $weekday_num)
1
)
}}
{{- $offset := add $yr_start.Weekday 1 }}
{{- if lt $est_yearday $offset }}
{{- continue -}}
{{- else if gt (sub $est_yearday $offset 1) $yr_end.YearDay }}
{{- break }}
{{- end -}}
{{- $uploads := "uploads" }}
{{- $y := add
(math.Mul $gaps_grid_inner (int $weekday_num) )
$offset_grid_down
-}}
{{- $rect_attrs = merge $rect_attrs (dict "y" $y) }}
{{- $yrday := sub $est_yearday $yr_start.Weekday 1 | int }}
{{- $curr_date := $yr_start.AddDate 0 0 $yrday }}
{{- $month := $curr_date.Format "Jan" }}
{{- $day:= humanize $curr_date.Day -}}
{{- if eq $count 0 }}
{{ $rect_attrs = merge $rect_attrs (dict "fill" $palette0) }}
{{- else if eq $count 1 }}
{{- $uploads = singularize $uploads }}
{{- $rect_attrs = merge $rect_attrs (dict "fill" $palette1) }}
{{- else if eq $count 2 }}
{{- $rect_attrs = merge $rect_attrs (dict "fill" $palette2) }}
{{- else if eq $count 3 }}
{{- $rect_attrs = merge $rect_attrs (dict "fill" $palette3) }}
{{- else if eq $count 4 }}
{{- $rect_attrs = merge $rect_attrs (dict "fill" $palette4) }}
{{- else if and (ge $count 5) (ne $calendar_style "github") }}
{{- $rect_attrs = merge $rect_attrs (dict "fill" $palette5) }}
{{- end -}}
<rect
{{- range $k, $v := $rect_attrs }}
{{- with $v }}
{{ printf " %s=%q" $k (string $v) | safeHTMLAttr }}
{{- end }}
{{- end }}
>
<title>
{{- printf "%d %s on %s %s" $count $uploads $month $day -}}
</title>
</rect>
{{ end -}}
</g>
{{ end }}
{{- range seq 1 12 }}
{{- $month := index $month_of_year (string . ) }}
{{- $x_month := add
(math.Mul (div (float (sub 100 $offset_grid_right)) 12) (sub . 1) )
$offset_grid_right
}}
<text
class="month"
x="{{ $x_month }}"
y="{{ $offset_months_down }}"
fill="var(--fg)"
>
{{ $month }}
</text>
{{- end -}}
{{ range seq 0 6 }}
{{- if and (not $p.Params.all_weekdays) (in (slice 0 2 4 6) . ) }}
{{- continue }}
{{- end }}
{{- $day := index $days_of_week (string . ) }}
{{- if eq $calendar_style "gitlab" }}
{{- $day = index $days_of_week (string . ) | truncate 1 "" }}
{{- end }}
{{- $y := add
(math.Mul (div (float (sub 15.5 $offset_grid_down)) 7) . )
$offset_grid_down
$offset_weekdays_down -}}
<text
class="weekday"
x="{{ $offset_weekdays_right }}"
y="{{ $y }}"
fill="{{ $square_fill }}"
>
{{ $day }}
</text>
{{ end }}
</svg>
</div>
<div class="legend">
<svg viewBox="0 0 30 3" width="240">
{{- $pad_l := 9 }}
{{- if (in (slice "codeberg" "forgejo" "gitea") $calendar_style) }}
{{- $pad_l = 7 }}
{{- else if (eq $calendar_style "gitlab") }}
{{- $pad_l = 0 }}
{{- end }}
{{- if not (eq $calendar_style "gitlab") }}
<text fill="{{ $square_fill }}" x="{{ $pad_l }}" y="1">
Less
</text>
{{- end }}
{{- range seq 0 (sub $palette_len 1) -}}
{{- $msg := "" }}
{{- if eq 0 . }}
{{- $msg = "no uploads" }}
{{- else if (eq 1 .) }}
{{- $msg = printf "%d upload" . }}
{{- else if lt (sub $palette_len 1) . }}
{{- $msg = printf "%d uploads" . }}
{{- else }}
{{- $msg = printf "%d uploads or more" . }}
{{- end }}
{{- $rect_attrs := $initial_rect_attrs }}
{{- $rect_attrs := merge $rect_attrs (dict
"fill" (index $palette . )
"x" (add (math.Mul 2 . ) 4 $pad_l )
)
-}}
<rect
{{- range $k, $v := $rect_attrs }}
{{- with $v }}
{{- printf " %s=%q" $k (string $v) | safeHTMLAttr }}
{{- end }}
{{- end }}
>
<title>{{ $msg }}</title>
</rect>
{{- end -}}
{{- if not (eq $calendar_style "gitlab") }}
<text
fill="{{ $square_fill }}"
x="{{ add (math.Mul 2 (len $palette) ) 4 $pad_l }}"
y="1"
>
More
</text>
{{- end }}
</svg>
<svg viewBox="0 0 30 3" width="240">
<a xlink:href="{{ safeHTMLAttr $info_link }}" target="_blank">
<text fill="{{ $square_fill }}" x="5" y="1.3">
Learn how we count uploads
</text>
</a>
</svg>
</div>
<div class="activity-overview">
<div class="tag-overview">
{{- $t := newScratch }}
{{- $t.Set "links" dict }}
{{- range $tag, $wpp := $p.Site.Taxonomies.tags }}
{{- $t.Add "only_tags" (slice $tag) }}
{{- $t.Set $tag 0 }}
{{- $t.SetInMap "links" $tag .Page.Permalink }}
{{- range $wpp }}
{{- if eq .Page.Date.Year $actual_year }}
{{- $t.Add $tag 1 }}
{{- end }}
{{- end }}
{{- end }}
{{- $t.Set "tags" slice }}
{{- range $t.Get "only_tags" }}
{{- $tag_count := $t.Get . }}
{{- if gt $tag_count 0 }}
{{- $t.Add "tags" (dict
"tag" .
"count" $tag_count
"link" (index ($t.Get "links") . ))
}}
{{- end }}
{{- end -}}
{{- $total_tags := len ($t.Get "tags")}}
<span>Activity Overview</span>
<p>Uploaded pages tagged with
{{- $i := 0 }}
{{- range sort ($t.Get "tags") "count" "desc" }}
{{- $i = add $i 1 }}
{{- if le $i (math.Sum 1 $tag_limit) }}
<a href="{{ .link }}">#{{ .tag }}</a> ({{ .count }})
{{- end }}
{{- end }}
{{- $remaining_tags := sub $total_tags (math.Sum 1 $tag_limit) }}
{{- if gt $remaining_tags 0 }}
and other {{ $remaining_tags }} tag(s).</p>
{{- else }}
.</p>
{{- end }}
</div>
<div class="radar-graph">
{{- range $pgs.GroupByDate "2006" "desc" }}
{{- if not (eq .Key (string $actual_year)) }}
{{- continue }}
{{- end }}
{{- $pp_by_year := .Pages }}
{{- $polygon_pts := "" }}
{{- $tot_pp_by_year := len .Pages }}
{{- $max_tot_pp := "" }}
{{- range $sns }}
{{- $length := len (where $pp_by_year "Section" "in" .) }}
{{- if gt $length $max_tot_pp }}
{{- $max_tot_pp = $length }}
{{- end }}
{{- end -}}
<svg viewBox="0 0 450 450" width="{{ $radar_width }}">
{{- range $sns }}
{{- $curr_sn := . }}
{{- $i := "" }}
{{- range seq 0 (sub $tot_mainsections 1) }}
{{- if eq $curr_sn (index $sns . )}}
{{- $i = . }}
{{- end }}
{{- end }}
{{- $new_angle := math.Mul $angle $i }}
{{- $pgs_by_section := where $pp_by_year "Section" "in" . }}
{{- $tot_sn_pp := len $pgs_by_section }}
{{- /* radius 1 cir coords */}}
{{- $x_coord := math.Sin $new_angle }}
{{- $y_coord := math.Cos $new_angle }}
{{- /* scale coords for labels */}}
{{- $label_x_coord := math.Mul $x_coord 170 }}
{{- $label_y_coord := math.Mul $y_coord 170 }}
{{- /* scale coords for polygon */}}
{{- $x_coord := math.Mul $x_coord 140 }}
{{- $y_coord := math.Mul $y_coord 140 }}
{{- /* set line outer coords */}}
{{- $line_x_coord := $x_coord }}
{{- $line_y_coord := $y_coord }}
{{- /* scale by relative proportion */}}
{{- $proportion := div (float $tot_sn_pp) $tot_pp_by_year }}
{{- $rel_prop := div (float $tot_sn_pp) $max_tot_pp }}
{{- $x_coord := math.Mul $x_coord $rel_prop }}
{{- $y_coord := math.Mul $y_coord $rel_prop }}
{{- /* transform coords for svg coord system (negative y) */}}
{{- $x_coord := add $x_coord 225 }}
{{- $y_coord := add (math.Mul $y_coord -1) 225 }}
{{- $line_x_coord := add $line_x_coord 225 }}
{{- $line_y_coord := add (math.Mul $line_y_coord -1) 225 }}
{{- $label_x_coord := add $label_x_coord 225 }}
{{- $label_y_coord := add (math.Mul $label_y_coord -1) 225 }}
{{- $coords := printf "%.3f,%.3f" $x_coord $y_coord }}
{{- /* concatenate polygon points */}}
{{- if eq $i 0 }}
{{- $polygon_pts = add $polygon_pts $coords }}
{{- else }}
{{- $polygon_pts = add $polygon_pts (printf " %s" $coords) }}
{{- end }}
{{- /* reset then set attributes for lines and circles */}}
{{- $line_attrs := $initial_line_attrs }}
{{- $line_attrs := merge $line_attrs (dict
"x2" $line_x_coord
"y2" $line_y_coord
)
-}}
{{- $cir_attrs := $initial_cir_attrs }}
{{- $cir_attrs := merge $cir_attrs (dict
"cx" $x_coord
"cy" $y_coord
)
-}}
{{- /* draw a line from center at every angle */}}
<line
{{- range $k, $v := $line_attrs }}
{{- with $v }}
{{- printf " %s=%q" $k (string $v) | safeHTMLAttr }}
{{- end }}
{{- end}}
/>
{{- /* draw a circle/dot at every polygon corner */}}
<circle
{{- range $k, $v := $cir_attrs }}
{{- with $v }}
{{- printf " %s=%q" $k (string $v) | safeHTMLAttr }}
{{- end }}
{{- end }}
/>
{{- /* label every polygon corner with name of corr. section */}}
{{- $label_sn := pluralize $curr_sn }}
{{- $label_sn_link := printf "%s%s" site.BaseURL $curr_sn }}
{{- $label_title := printf "%d total %s" $tot_sn_pp $label_sn }}
<text
class="label"
x="{{ $label_x_coord }}"
y="{{ $label_y_coord }}"
transform="translate(-24 0)"
fill="{{ $square_fill }}"
>
{{ printf "%.2f%%" (math.Mul $proportion 100) }}
<title>{{ $label_title }}</title>
</text>
<a xlink:href="{{ safeHTMLAttr $label_sn_link }}">
<text
class="label"
x="{{ $label_x_coord }}"
y="{{ $label_y_coord }}"
transform="translate(-24 20)"
fill="{{ $square_fill }}">
{{ title . }}
<title>{{ $label_title }}</title>
</text>
</a>
{{ end }}
{{- /* draw the polygon after iterating sections */}}
<polygon
points="{{ $polygon_pts }}"
fill="{{ $polygon_fill }}"
opacity="{{ $polygon_opacity }}"
/>
</svg>
{{- end }}
</div>
</div>
</div>
</div>
{{- end }}
The data get populated in lines 1-125, then iterated though lines 283-668, more specifically the actual calendar graph in lines 284-410.
I have tested this to happen with three different editors, Helix, Kakoune and Pragtical, the issue happened in all of them although sometimes it did not happen. I could not reproduce when the issue did not happen.The issue is not too important as one can always save to file again to reverse the years to the intended way.
I only ask some insight on why this might be happening and what may I do to fix it, as I am not a developer and my website is cobbled together in pretty amateur fashion. Thanks in advance.
Re-edit: Put links back in.