-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from kentnek/kent-social-icons
- Loading branch information
Showing
10 changed files
with
57 additions
and
35 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 |
---|---|---|
|
@@ -52,32 +52,36 @@ If you would rather override the about page's layout with your own, you can do s | |
|
||
### Configuring Social Icons | ||
|
||
Social Icons are optional. As of right now we support Twitter and GitHub, but more can be supported in the future. To show any of these icons, just provide the value in the `[params]` section of `config.toml`. | ||
Social Icons are optional. To show any of these icons, just provide the value in the `[params]` section of `config.toml`. | ||
|
||
```toml | ||
# config.toml | ||
|
||
[params] | ||
twitter = "hugo-theme-codex" | ||
github = "jakewies/hugo-theme-codex" | ||
twitter = "https://twitter.com/GoHugoIO" | ||
github = "https://github.com/jakewies/hugo-theme-codex" | ||
# ... | ||
|
||
iconTitles = ["Twitter", "GitHub"] | ||
``` | ||
|
||
If either of these options are given, `hugo-theme-codex` will render the social icon in the footer. | ||
If any of these options are given, `hugo-theme-codex` will render the social icon in the footer, using the order specified in `iconTitles`. | ||
|
||
See the contents of the [example site](https://github.com/jakewies/hugo-theme-codex/tree/master/exampleSite) for more details. | ||
|
||
You can also create additional social icons by replicating the code in `partials/social-icons.html`. For example, to add an email social icon, you can add the follwing: | ||
|
||
```html | ||
<a class="social-icons__icon social-icons__icon--email" href="mailto:[email protected]"></a> | ||
``` | ||
Note that you also need to add the following css in corresponding css files where social icons are displayed, i.e. `about.css` and `post.css`: | ||
|
||
```css | ||
.social-icons__icon--email { | ||
background-image: url("/icons/email.svg"); | ||
} | ||
``` | ||
You can also create additional social icons by: | ||
1. Add your own SVGs in `static/icons/`, for example `static/icons/reddit.svg`. | ||
2. Modify your site's config as follows: | ||
```toml | ||
[params] | ||
# ... | ||
reddit = "<url to your reddit>" | ||
|
||
iconTitles = [ "...", "Reddit"] | ||
``` | ||
|
||
Make sure that the icon title must match the icon's file name. If the title contains more than one word, say "My Awesome Site", | ||
you can use dash "-" for the icon name: `my-awesome-site.svg`. | ||
|
||
### Creating a blog post | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
{{ $currentPage := . }} | ||
{{ $icons := .Site.Params.iconOrder | default (slice "Twitter" "GitHub" "Email" "Facebook" "GitLab" "Instagram" "LinkedIn" "YouTube") }} | ||
|
||
<div class="social-icons"> | ||
{{ if isset .Site.Params "twitter" }} | ||
<a class="social-icons__icon social-icons__icon--twitter" href="https://twitter.com/{{ .Site.Params.twitter }}"></a> | ||
{{ end }} | ||
{{ if isset .Site.Params "github" }} | ||
<a class="social-icons__icon social-icons__icon--github" href="https://github.com/{{ .Site.Params.github }}"></a> | ||
{{ end }} | ||
{{ range $icons }} | ||
{{ $icon := anchorize . }} | ||
{{ if isset $currentPage.Site.Params $icon }} | ||
<a class="social-icons__icon" title="{{ . }}" | ||
style="background-image: url(/icons/{{ $icon }}.svg)" | ||
href="{{ index $currentPage.Site.Params $icon }}" | ||
target="_blank" rel="noopener"> | ||
</a> | ||
{{ end }} | ||
{{ end }} | ||
</div> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.