feat: Hugo engine for iGaming affiliate template (layouts, assets, i18n, verified data, CI build script)
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
{{- /* cta-button.html — the ONLY place an affiliate link is constructed.
|
||||
Link = brand.affiliateBaseUrl ? brand.affiliateSubIdParam = <per-page sub-id>.
|
||||
Never hardcode a raw affiliate URL anywhere else.
|
||||
|
||||
Call with a dict:
|
||||
{{ partial "cta-button.html" (dict "page" . "text" "Play Now") }}
|
||||
Optional keys: subid, style ("primary"|"secondary"), size ("lg"), class, block(bool).
|
||||
|
||||
Sub-id resolution (robust when .File is nil for generated pages):
|
||||
explicit subid -> .File.ContentBaseName -> .Type -> "home"
|
||||
ContentBaseName equals the classic BaseFileName for standard pages and,
|
||||
unlike BaseFileName, yields the real slug for page bundles (e.g. games). */ -}}
|
||||
{{- $page := .page -}}
|
||||
{{- $brand := $page.Site.Data.brand -}}
|
||||
{{- $text := .text | default "Visit Casino" -}}
|
||||
{{- $style := .style | default "primary" -}}
|
||||
{{- $size := .size | default "" -}}
|
||||
|
||||
{{- $subid := .subid | default "" -}}
|
||||
{{- if not $subid -}}
|
||||
{{- if $page.IsHome -}}
|
||||
{{- $subid = "home" -}}
|
||||
{{- else -}}
|
||||
{{- with $page.File -}}{{- $subid = .ContentBaseName -}}{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if not $subid -}}{{- $subid = $page.Type -}}{{- end -}}
|
||||
{{- if or (eq $subid "_index") (eq $subid "") -}}{{- $subid = "home" -}}{{- end -}}
|
||||
|
||||
{{- $href := printf "%s?%s=%s" $brand.affiliateBaseUrl $brand.affiliateSubIdParam $subid -}}
|
||||
|
||||
{{- $classes := "btn-primary" -}}
|
||||
{{- if eq $style "secondary" -}}{{- $classes = "btn-secondary" -}}{{- end -}}
|
||||
{{- if eq $style "ghost" -}}{{- $classes = "btn-ghost" -}}{{- end -}}
|
||||
{{- if $size -}}{{- $classes = printf "%s btn-%s" $classes $size -}}{{- end -}}
|
||||
{{- if .block -}}{{- $classes = printf "%s w-full" $classes -}}{{- end -}}
|
||||
{{- with .class -}}{{- $classes = printf "%s %s" $classes . -}}{{- end -}}
|
||||
|
||||
<a href="{{ $href }}" class="{{ $classes }}" rel="sponsored nofollow noopener" target="_blank" data-affiliate data-subid="{{ $subid }}">{{ $text }}</a>
|
||||
Reference in New Issue
Block a user