-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
14 changed files
with
230 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,6 +123,66 @@ This theme includes a shortcode for a contact form that you can add to any page | |
{{< form-contact action="https://formspree.io/[email protected]" >}} | ||
``` | ||
|
||
### Social Follow + Share | ||
|
||
The theme automatically adds "Follow" link icons to the header and footer and "Share" link icons to pages unless `disable_share` site parameter is set to true. Each built-in services sports a label, an icon and a color. | ||
|
||
In order to register a service to be used, user must add an `ananke_socials` parameter to its project configuration file and list them through it in the desired order. Each entry must bear a | ||
- name*: It matches the built-in service reference (Ex: twitter, github) | ||
- url*: The url of the handle's profile on the service (Ex: https://twitter.com/theNewDynamic, https://github.com/ | ||
theNewDynamic) | ||
|
||
```yaml | ||
params: | ||
ananke_socials: | ||
- name: twitter | ||
url: https://twitter.com/theNewDynamic | ||
- name: github | ||
url: https://github.com/theNewDynamic | ||
``` | ||
If user needs to overwrite default `color` and `label` of the service, they simply need to append the following to the entry: | ||
- label: The displayed name of the service to be used to popuplate `[title]` attributes and read-only. (Ex: Twitter, GitHub) | ||
- color: Used for styling purposes. (Ex: '#1da1f2', '#6cc644') | ||
|
||
```yaml | ||
params: | ||
ananke_socials: | ||
- name: twitter | ||
url: https://twitter.com/theNewDynamic | ||
label: TND Twitter | ||
- name: github | ||
url: https://github.com/theNewDynamic | ||
label: TND GitHub Account | ||
color: '#ff6800' | ||
``` | ||
|
||
#### Social Icons Customization | ||
|
||
On top of easily customizing the built-in services' label and color, user can overwrite their icon by adding an svg file at `/assets/ananke/socials` with a filename matching the service's name. | ||
For example, in order to use your own GitHub icon, simply add an svg file at `/assets/ananke/socials/github.svg` | ||
|
||
#### Built-in Services | ||
Here is the list of built-in services. Those marked with an `*` are also part of the "Share" module. | ||
|
||
- twitter* | ||
- youtube | ||
- github | ||
- gitlab | ||
- keybase | ||
- linkedin* | ||
- medium | ||
- mastodon | ||
- slack | ||
- stackoverflow | ||
- facebook* | ||
- rss | ||
|
||
#### Complement | ||
|
||
In order to add an unkown service (absent from the list above), you simply need to add all three settings to `ananke_socials`: name, url, label, color, and optionally add an icon file matching the `name` to the `assets/ananke/socials` directory. In the absence of an icon, the theme will print the service's label. | ||
|
||
### Update font or body classes | ||
|
||
The theme is set, by default, to use a near-white background color and the "Avenir" or serif typeface. You can change these in your config file with the `body_classes` parameter, like this: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{{/* | ||
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 }} |
26 changes: 26 additions & 0 deletions
26
...artials/func/socials/GetServicesData.html → ...c/socials/GetBuiltInServicesDefaults.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{{/* | ||
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,27 @@ | ||
{{ $service_data := dict }} | ||
{{ $services_data := partialCached "func/socials/GetServicesData" "socials/GetServicesData" }} | ||
{{/* | ||
socials/GetServiceDefaults | ||
Returns the defaults of any given service as stored in GetBuildInServicesDefaults | ||
|
||
@author @regisphilibert | ||
|
||
@context String (.) | ||
|
||
{{ with index $services_data $ }} | ||
{{ $service_data = . }} | ||
{{ end }} | ||
@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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
resources/_gen/assets/css/ananke/css/main.css_bb5467e0521bbea6b1e66429f6ec028e.content
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
resources/_gen/assets/css/ananke/css/main.css_bb5467e0521bbea6b1e66429f6ec028e.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"Target":"ananke/css/main.min.css","MediaType":"text/css","Data":{}} |