theme(fix): cleanup unused functions
Signed-off-by: Patrick Kollitsch <patrick@davids-neighbour.com>
This commit is contained in:
parent
14eeb655ce
commit
825ea52af9
|
@ -1,45 +0,0 @@
|
||||||
{{/*
|
|
||||||
socials/Get
|
|
||||||
Returns the list of services registered by the user complemented by the built-in service default data if found.
|
|
||||||
|
|
||||||
@author @regisphilibert
|
|
||||||
|
|
||||||
@context Any (.)
|
|
||||||
|
|
||||||
@access public
|
|
||||||
|
|
||||||
@returns Slice of Maps
|
|
||||||
- String (.name)
|
|
||||||
String (.url)
|
|
||||||
String (.label)
|
|
||||||
String (.color)?
|
|
||||||
Bool (.share)?
|
|
||||||
@uses
|
|
||||||
- partial
|
|
||||||
|
|
||||||
@example - Go Template
|
|
||||||
{{ with partialCached "socials/Get" context context }}
|
|
||||||
{{ something = . }}
|
|
||||||
{{ end }}
|
|
||||||
*/}}
|
|
||||||
{{ $socials := slice }}
|
|
||||||
{{ with partial "func/socials/GetRegisteredServices" "GetRegisteredServices" }}
|
|
||||||
{{ range . }}
|
|
||||||
{{ $service := . }}
|
|
||||||
{{/* We fetch the default data and add it to service map if found */}}
|
|
||||||
{{ with partialCached "func/socials/GetServiceData" .name .name }}
|
|
||||||
{{ $service = merge . $service }}
|
|
||||||
{{ end }}
|
|
||||||
{{/* We fetch the icon and add it to service map fi found */}}
|
|
||||||
{{ with partialCached "func/socials/GetServiceIcon" .name .name }}
|
|
||||||
{{ $service = $service | merge (dict "icon" . ) }}
|
|
||||||
{{ end }}
|
|
||||||
{{/* In case no label is provided (on a non-built-in service) we add the .name as label to the service map */}}
|
|
||||||
{{ with .label }}{{ else }}
|
|
||||||
{{ $service = $service | merge (dict "label" $service.name ) }}
|
|
||||||
{{ end }}
|
|
||||||
{{ $socials = $socials | append $service }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ return $socials }}
|
|
|
@ -1,73 +0,0 @@
|
||||||
{{/*
|
|
||||||
GetBuiltInServicesData
|
|
||||||
Returns a map whose keys stores the map of defaults data for any built-in service.
|
|
||||||
We use a key to easily grab the data with `index $that github`
|
|
||||||
|
|
||||||
@author @regisphilibert
|
|
||||||
|
|
||||||
@context Any (.)
|
|
||||||
|
|
||||||
@access public
|
|
||||||
|
|
||||||
@returns Map
|
|
||||||
|
|
||||||
|
|
||||||
## Contributors can add a built-in service
|
|
||||||
|
|
||||||
1. Adding it to the following map with the following format:
|
|
||||||
```yaml
|
|
||||||
# [...]
|
|
||||||
shinyandnew:
|
|
||||||
label: Shiny And New
|
|
||||||
color: '#cccccc'
|
|
||||||
```
|
|
||||||
2. Edit README file with new service https://github.com/theNewDynamic/gohugo-theme-ananke/tree/422-improve-socials#built-in-services
|
|
||||||
|
|
||||||
*/}}
|
|
||||||
{{ return (`
|
|
||||||
facebook:
|
|
||||||
share: true
|
|
||||||
label: Facebook
|
|
||||||
color: '#3b5998'
|
|
||||||
twitter:
|
|
||||||
share: true
|
|
||||||
label: Twitter
|
|
||||||
color: '#1da1f2'
|
|
||||||
instagram:
|
|
||||||
label: Instagram
|
|
||||||
color: '#e1306c'
|
|
||||||
youtube:
|
|
||||||
label: YouTube
|
|
||||||
color: '#cd201f'
|
|
||||||
github:
|
|
||||||
label: GitHub
|
|
||||||
color: '#6cc644'
|
|
||||||
gitlab:
|
|
||||||
label: GitLab
|
|
||||||
color: '#FC6D26'
|
|
||||||
keybase:
|
|
||||||
label: Keybase
|
|
||||||
color: '#3d76ff'
|
|
||||||
linkedin:
|
|
||||||
share: true
|
|
||||||
label: LinkedIn
|
|
||||||
color: '#0077b5'
|
|
||||||
medium:
|
|
||||||
label: Medium
|
|
||||||
color: '#0077b5'
|
|
||||||
mastodon:
|
|
||||||
label: Mastodon
|
|
||||||
color: '#6364FF'
|
|
||||||
slack:
|
|
||||||
label: Slack
|
|
||||||
color: '#E01E5A'
|
|
||||||
stackoverflow:
|
|
||||||
label: Stack Overflow
|
|
||||||
color: '#f48024'
|
|
||||||
rss:
|
|
||||||
label: RSS
|
|
||||||
color: '#ff6f1a'
|
|
||||||
tiktok:
|
|
||||||
label: TikTok
|
|
||||||
color: '#fe2c55'
|
|
||||||
` | transform.Unmarshal) }}
|
|
|
@ -1,45 +0,0 @@
|
||||||
{{/*
|
|
||||||
socials/GetRegisteredServices
|
|
||||||
Retrieves the list of user registered services.
|
|
||||||
Support legacy settings (root of params with service name as key)
|
|
||||||
|
|
||||||
@author @regisphilibert
|
|
||||||
|
|
||||||
@context Any (.)
|
|
||||||
|
|
||||||
@access private
|
|
||||||
|
|
||||||
@returns Slice of Maps
|
|
||||||
- String (.name)
|
|
||||||
String (.url)
|
|
||||||
String (.label)?
|
|
||||||
String (.color)?
|
|
||||||
|
|
||||||
*/}}
|
|
||||||
|
|
||||||
{{ $registered_services := slice }}
|
|
||||||
{{/* We first look for legacy settings that lives at the root of the site.Params as such (github: https://github.com/
|
|
||||||
theNewDynamic) and them to the list with key as .name and value as .url */}}
|
|
||||||
{{ $user_using_legacy := false }}
|
|
||||||
|
|
||||||
{{ $legacy_api_services := slice "facebook" "twitter" "instagram" "youtube" "github" "gitlab" "keybase" "linkedin" "medium" "mastodon" "slack" "stackoverflow" "rss" }}
|
|
||||||
{{ range $name := $legacy_api_services }}
|
|
||||||
{{ with $url := index site.Params . }}
|
|
||||||
{{/* If we can find a parameter matching the key with a set value, we add it with proper name and url */}}
|
|
||||||
{{/* We also note that user is using legacy for potential potential deprecation warnings */}}
|
|
||||||
{{ $user_using_legacy = true }}
|
|
||||||
{{ $registered_services = $registered_services | append (dict "name" $name "url" $url) }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{/* Then we go through the current way of registering services as per referenced in README */}}
|
|
||||||
{{ with site.Params.ananke_socials }}
|
|
||||||
{{ range $service := . }}
|
|
||||||
{{/* Only if the service has a .name, we add it all its keys to the slice of registered services */}}
|
|
||||||
{{ with .name }}
|
|
||||||
{{ $registered_services = $registered_services | append $service }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ return $registered_services }}
|
|
|
@ -1,27 +0,0 @@
|
||||||
{{/*
|
|
||||||
socials/GetServiceDefaults
|
|
||||||
Returns the defaults of any given service as stored in GetBuildInServicesDefaults
|
|
||||||
|
|
||||||
@author @regisphilibert
|
|
||||||
|
|
||||||
@context String (.)
|
|
||||||
|
|
||||||
@access private
|
|
||||||
|
|
||||||
@returns Map
|
|
||||||
- String (.label)
|
|
||||||
String (.color)
|
|
||||||
@uses
|
|
||||||
- func/socials/GetBuiltInServicesDefaults
|
|
||||||
|
|
||||||
*/}}
|
|
||||||
{{ $service_data := dict }}
|
|
||||||
{{ with partialCached "func/socials/GetBuiltInServicesDefaults" "socials/GetBuiltInServicesDefaults" }}
|
|
||||||
{{/* If the passed context string (held in $) is found as a key of the map returned by the above returning partial
|
|
||||||
We store it in the returning variable */}}
|
|
||||||
{{ with index . $ }}
|
|
||||||
{{ $service_data = . }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ return $service_data }}
|
|
|
@ -1,21 +0,0 @@
|
||||||
{{/*
|
|
||||||
GetServiceIcon
|
|
||||||
|
|
||||||
User can overwrite/complement in assets/ananke/socials/{service_name}.svg
|
|
||||||
|
|
||||||
@author @regisphilibert
|
|
||||||
|
|
||||||
@context String (.)
|
|
||||||
|
|
||||||
@access private
|
|
||||||
|
|
||||||
@return String of safe HTML
|
|
||||||
|
|
||||||
@example - Go Template
|
|
||||||
{{ $icon := partialCached "tnd-socials/private/GetIcon" $icon $icon }}
|
|
||||||
*/}}
|
|
||||||
{{ $icon := "" }}
|
|
||||||
{{ with resources.Get (printf "ananke/socials/%s.svg" $) }}
|
|
||||||
{{ $icon = .Content | safeHTML }}
|
|
||||||
{{ end }}
|
|
||||||
{{ return $icon }}
|
|
|
@ -41,7 +41,6 @@
|
||||||
{{ $socials_css := $socials_rules | resources.FromString "ananke/css/generated_socials.css" }}
|
{{ $socials_css := $socials_rules | resources.FromString "ananke/css/generated_socials.css" }}
|
||||||
{{ $assets_to_concat = $assets_to_concat | append $socials_css }}
|
{{ $assets_to_concat = $assets_to_concat | append $socials_css }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{/* We look for any custom css files registered by the user under `site.params.custom_css and if found in the theme's
|
{{/* We look for any custom css files registered by the user under `site.params.custom_css and if found in the theme's
|
||||||
|
|
Loading…
Reference in a new issue