Skip to content

Commit

Permalink
Merge pull request kakawait#23 from kakawait/enhancement/migrate-ga-t…
Browse files Browse the repository at this point in the history
…o-analytics

Migrate old GA script to new
  • Loading branch information
kakawait authored Nov 13, 2016
2 parents 455061d + 978d8c2 commit ad18f6e
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 26 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Change Log

All notable changes to this project will be documented in this file.

## [0.1.1-ALPHA] 13 nov 2016

- Upgrade *Google Analytics* script to do not use anymore `ga.js` which is now deprecated (#21)
- **[Breaking changes]** Changes *Google Analytics* config key from `params.google_analytics_id` to official `googleAnalytics` (#21)
- Add parameter to choose between sync/async loading of *Google Analytics* `params.ga.async` (#21)
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ A gorgeous responsive theme for Hugo blog framework.

![Tranquilpeak](https://raw.githubusercontent.com/kakawait/hugo-tranquilpeak-theme/master/showcase.png)

## Alpha/Beta versions

**ATTENTION** during *alpha* or *beta* [versions](https://github.com/kakawait/hugo-tranquilpeak-theme/milestones) breaking changes are possible on config file.

You can track [breaking changes label](https://github.com/kakawait/hugo-tranquilpeak-theme/issues?q=is%3Aissue+is%3Aopen+label%3A%22breaking+changes%22) or simply read [CHANGELOG.md](https://github.com/kakawait/hugo-tranquilpeak-theme/CHANGELOG.md).

Moreover you can use `migrators` from `migrators` folders. Migration scripts will produces a new config file with suffix `.new`, it will not override your current config. Indeed migration scripts will erase any comments and formating, that why migration scripts will not override your config.

Any modifications are printed on output to allow you reproduce/replay migrations on your own config file manually.

## Credits

*Hugo* version of Tranquilpeak is a based on original *Hexo* version https://github.com/LouisBarranqueiro/hexo-theme-tranquilpeak. This version is simply a port to *Hugo* static site generator.
Expand Down Expand Up @@ -134,5 +144,5 @@ That mean I would keep a stronge dependency with original *Hexo* theme. Thus if

## License

hugo-tranquilpeak-theme is released under the terms of the [GNU General Public License v3.0](LICENSE).
hugo-tranquilpeak-theme is released under the terms of the [GNU General Public License v3.0](https://github.com/kakawait/hugo-tranquilpeak-theme/blob/master/LICENSE).

8 changes: 4 additions & 4 deletions docs/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ The same page with `hierarchical_categories = false`:
#### Integrated services

```toml
DisqusShortname =
disqusShortname =
googleAnalytics =
```

```toml
Expand All @@ -319,14 +320,13 @@ DisqusShortname =
[params]
fb_admin_ids =
fb_app_id =
google_analytics_id =
```

| Variable | Description |
|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| disqus_shortnam | Your Disqus shortname. |
| disqusShortname | Your Disqus shortname. |
| gravatar_email | Your gravatar email. Overwrite `author.picture` everywhere in the blog |
| google_analytics_id | Your Google analystics web property ID : UA-XXXXX-X |
| googleAnalytics | Your Google analystics web property ID : UA-XXXXX-X |
| fb_admin_ids | Your Facebook user ids used to connect your blog with your facebook user accounts (Facebook Insights). Separate ids with comma. E.g : `9830047,1003342`. Visit [Facebook docs](https://developers.facebook.com/docs/platforminsights/domains) for more information. |
| fb_app_id | Your Facebook app id used to connect your blog with your facebook app account (Facebook Insights). E.g : `9841307`. Visit [Facebook docs](https://developers.facebook.com/docs/platforminsights/domains) for more information. |

Expand Down
3 changes: 3 additions & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ languageCode = "en-us"
title = "Hugo tranquilpeak theme"
theme = "hugo-tranquilpeak-theme"
DisqusShortname = "hugo-tranquilpeak-theme"
# googleAnalytics = "UA-123-45"
Paginate = 7
canonifyurls = true

Expand Down Expand Up @@ -103,6 +104,8 @@ canonifyurls = true

hierarchical_categories = true

description = "Hugo tranquilpeak theme demo"

# Customization
# Define the behavior of the sidebar
# 1: Display extra large sidebar on extra large screen, large sidebar on large screen,
Expand Down
58 changes: 50 additions & 8 deletions exampleSite/content/post/Welcome-to-the-new-Tranquilpeak.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ A gorgeous responsive theme for Hugo blog framework

[![Tranquilpeak](/img/showcase.png)](https://tranquilpeak.kakawait.com)

## Alpha/Beta versions

**ATTENTION** during *alpha* or *beta* [versions](https://github.com/kakawait/hugo-tranquilpeak-theme/milestones) breaking changes are possible on config file.

You can track [breaking changes label](https://github.com/kakawait/hugo-tranquilpeak-theme/issues?q=is%3Aissue+is%3Aopen+label%3A%22breaking+changes%22) or simply read [CHANGELOG.md](https://github.com/kakawait/hugo-tranquilpeak-theme/CHANGELOG.md).

Moreover you can use `migrators` from `migrators` folders. Migration scripts will produces a new config file with suffix `.new`, it will not override your current config. Indeed migration scripts will erase any comments and formating, that why migration scripts will not override your config.

Any modifications are printed on output to allow you reproduce/replay migrations on your own config file manually.

## Credits

*Hugo* version of Tranquilpeak is a based on original *Hexo* version https://github.com/LouisBarranqueiro/hexo-theme-tranquilpeak. This version is simply a port to *Hugo* static site generator.
Expand All @@ -58,7 +68,7 @@ Please all the credit should be attributed to [original *Hexo* version](https://

- **Authors**: [Louis Barranqueiro (LouisBarranqueiro)](https://github.com/LouisBarranqueiro) and [Thibaud Leprêtre (kakawait)](https://github.com/kakawait)
- **Version**: 0.1.0-ALPHA (based on Hexo version 1.9.1)
- **Compatibility**: Hugo v0.16
- **Compatibility**: Hugo v0.17

## Features

Expand All @@ -72,6 +82,7 @@ Please all the credit should be attributed to [original *Hexo* version](https://
- Beautiful about page
- Support Open Graph protocol
- Easily customizable (fonts, colors, layout elements, code coloration, etc..)
- Documentations

**Posts features:**

Expand All @@ -92,13 +103,13 @@ Please all the credit should be attributed to [original *Hexo* version](https://
- Gravatar
- Facebook Insights

### Todo of missing features from original *Hexo* version
### Missing features from original *Hexo* version

- [ ] Support internationalization (i18)
- [ ] Support internationalization (i18) (https://github.com/kakawait/hugo-tranquilpeak-theme/issues/9)
- [ ] Duoshuo
- [ ] Baidu analytics
- [ ] Algolia
- [ ] Documentations
- [ ] Algolia (https://github.com/kakawait/hugo-tranquilpeak-theme/issues/8)
- [ ] Pagination custumization `tag_pagination`, `category_pagination` and `archive_pagination` (https://github.com/kakawait/hugo-tranquilpeak-theme/issues/17)

**ATTENTION** following features will not be possible due to *Hugo* limitations

Expand All @@ -107,17 +118,47 @@ Please all the credit should be attributed to [original *Hexo* version](https://

## Quick start

Coming soon (see https://github.com/kakawait/hugo-tranquilpeak-theme/issues/4)
**Please read [user documentation](https://github.com/kakawait/hugo-tranquilpeak-theme/blob/master/docs/user.md), it's short and useful to discover all features and possibilities of the theme, especially the [writing posts](https://github.com/kakawait/hugo-tranquilpeak-theme/blob/master/docs/user.md#writing-posts) section**

##### For people who want to use the original version of Tranquilpeak without modifications (users)

Go to the directory where you have your Hugo site and run:

```shell
mkdir themes
cd themes
git clone https://github.com/kakawait/hugo-tranquilpeak-theme.git
```

After installing the Tranquilpeak theme successfully, we recommend you to take a look at the [exampleSite](exampleSite) directory. You will find a working Hugo site configured with the Universal theme that you can use as a starting point for your site.

First, let's take a look at the [config.toml](exampleSite/config.tom). It will be useful to learn how to customize your site. Feel free to play around with the settings.

More information on [user documentation](https://github.com/kakawait/hugo-tranquilpeak-theme/blob/master/docs/user.md) to install and configure the theme

##### For people who want to create their own version of tranquilpeak (developers)

1. Run `git clone https://github.com/kakawait/hugo-tranquilpeak-theme.git`
2. Follow [developer documentation](https://github.com/kakawait/hugo-tranquilpeak-theme/blob/master/docs/developer.md) to edit and build the theme

## Demo

Coming soon (see https://github.com/kakawait/hugo-tranquilpeak-theme/issues/3)
Check out Tranquilpeak theme in live : [hugo-tranquilpeak-theme demo](https://tranquilpeak.kakawait.com)

## Showcase

I would like to create a showcase with all blogs that use Tranquilpeak, please, add your blog into.
Checkout showcase https://github.com/kakawait/hugo-tranquilpeak-theme/wiki/Showcase

### How can I add my site to the showcase

**Click [here](https://github.com/kakawait/hugo-tranquilpeak-theme/issues/new?title=Add%20my%20blog%20into%20the%20showcase&body=Hey,%20add%20my%20blog%20into%20the%20showcase:) to add your blog into the showcase.**

Please fill the following information:

1. public url
2. name (optional)
3. description (optional)

## Documentation

Coming soon (see https://github.com/kakawait/hugo-tranquilpeak-theme/issues/4)
Expand All @@ -136,3 +177,4 @@ That mean I would keep a stronge dependency with original *Hexo* theme. Thus if

hugo-tranquilpeak-theme is released under the terms of the [GNU General Public License v3.0](https://github.com/kakawait/hugo-tranquilpeak-theme/blob/master/LICENSE).


12 changes: 0 additions & 12 deletions layouts/partials/google-analytics.html

This file was deleted.

6 changes: 5 additions & 1 deletion layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,9 @@
<link rel="stylesheet" href="/css/style-zfzvxnwixwz6qe7xv3xz1eyvlzc7cdfoxrgduk75zpqxib0hatbphiq9sddx.min.css" />
<!--STYLES END-->

{{ partial "google-analytics.html" }}
{{ if .Params.ga.async }}
{{ template "_internal/google_analytics_async.html" . }}
{{ else }}
{{ template "_internal/google_analytics.html" . }}
{{ end }}
</head>
26 changes: 26 additions & 0 deletions migrations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Migrations

## 0.1.0-ALPHA to 0.1.1-ALPHA

### Using migration script

```bash
./0_1_0_to_0_1_1 /path/to/config.toml
```

Should works with `.toml`, `.yml` and `.json`

### Manually

Replace

```toml
[params]
google_analytics_id = "UA-XXX-X"
```

to (top level)

```toml
googleAnalytics = "UA-XXX-X"
```

0 comments on commit ad18f6e

Please sign in to comment.