# Theme: SSHQ

**URL:** <https://discourse.gohugo.io/t/theme-sshq/413>\
**Category:** tips & tricks\
**Created:** [December 1, 2014, 10:31pm UTC](https://discourse.gohugo.io/t/theme-sshq/413 "2014-12-01T22:31:50Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael\_henderson](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/michael_henderson/32/10490_2.png) [@michael\_henderson](https://discourse.gohugo.io/u/michael_henderson)\
**Post date:** [December 1, 2014, 10:31pm UTC](https://discourse.gohugo.io/t/theme-sshq/413/1 "2014-12-01T22:31:50Z")

</div>

I’ve ported the theme from Octopress 2.0 to Hugo. I picked Octopress because it was my favorite SSG before Hugo.

It’s tested with Hugo v0.12 and it’s available at  
[https://github.com/quoha/sshq](https://github.com/quoha/sshq)

![](https://yyz2.discourse-cdn.com/flex036/uploads/gohugo/153/2a08b9fa1605d18f.png)

There’s support for Google site search and analytics, plus Disqus and Twitter feeds.

I’ll send a push request for hugoThemes shortly.

---

<div class="post-metadata">

**Author:** ![spf13](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/spf13/32/37_2.png) [@spf13](https://discourse.gohugo.io/u/spf13)\
**Post date:** [December 2, 2014, 5:09pm UTC](https://discourse.gohugo.io/t/theme-sshq/413/2 "2014-12-02T17:09:19Z")

</div>

@michael_henderson I think you have commit access to the hugoThemes repo so you can just add it yourself. Let me know if that’s not the case.

---

<div class="post-metadata">

**Author:** ![michael\_henderson](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/michael_henderson/32/10490_2.png) [@michael\_henderson](https://discourse.gohugo.io/u/michael_henderson)\
**Post date:** [December 2, 2014, 6:43pm UTC](https://discourse.gohugo.io/t/theme-sshq/413/3 "2014-12-02T18:43:31Z")

</div>

I do and I’m going to use this as an opportunity to learn both sides of the pull request 🙂 Git still worries the heck out of me.

---

<div class="post-metadata">

**Author:** ![wooken](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/wooken/32/157_2.png) [@wooken](https://discourse.gohugo.io/u/wooken)\
**Post date:** [December 8, 2014, 10:33pm UTC](https://discourse.gohugo.io/t/theme-sshq/413/4 "2014-12-08T22:33:53Z")

</div>

I hope this is not too off-topic. I am interested in how to get site search and google analytics to work.

I tried porting over analytics.html and I get the following error:

```
executing "partials/google/analytics.html" at <.google.analytics>: can't evaluate field analytics in type interface {} in partials/google/analytics.html

```

I would’ve tried site search first but your commit message said you only have it “sort of” working.

---

<div class="post-metadata">

**Author:** ![michael\_henderson](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/michael_henderson/32/10490_2.png) [@michael\_henderson](https://discourse.gohugo.io/u/michael_henderson)\
**Post date:** [December 9, 2014, 2:52am UTC](https://discourse.gohugo.io/t/theme-sshq/413/5 "2014-12-09T02:52:44Z")

</div>

The analytics is mostly from @spf13’s example near the bottom [http://gohugo.io/templates/partials/](http://gohugo.io/templates/partials/). That’s pretty straightforward.

I have a bunch of logic in `partials/google/analytics.html` to prevent it from displaying if the `config.toml` isn’t set up. That’s through a couple of variables in the `config.toml` file. Could that be what’s causing your error?

```auto
[Params.theme]
	ga_tracking = true
[Params.google.analytics]
	account = "UA-XXXXXXXXX-1"

```

The part that isn’t really working is the search. I have a Javascript hack that forces the sitename into the Google search variable when it is posting. It actually works okay for what it does.

What it doesn’t do is allow you to search without leaving your site. There’s a Google API for that at [https://developers.google.com/custom-search/json-api/v1/overview](https://developers.google.com/custom-search/json-api/v1/overview).

---

<div class="post-metadata">

**Author:** ![wooken](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/wooken/32/157_2.png) [@wooken](https://discourse.gohugo.io/u/wooken)\
**Post date:** [December 9, 2014, 9:23am UTC](https://discourse.gohugo.io/t/theme-sshq/413/6 "2014-12-09T09:23:17Z")

</div>

Thank you for pointing out the analytics page present in the hugo documentation. I will be looking into it.

Actually, the above error happens when I do have ga\_tracking enabled. But I actually had the account variable set up with empty quotes. That might actually have caused the error but I won’t know for sure until I get a chance to test it.

---

<div class="post-metadata">

**Author:** ![gour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/gour/32/197_2.png) [@gour](https://discourse.gohugo.io/u/gour)\
**Post date:** [March 11, 2015, 10:57am UTC](https://discourse.gohugo.io/t/theme-sshq/413/7 "2015-03-11T10:57:33Z")

</div>

> [@michael\_henderson](#):
>
> It’s tested with Hugo v0.12 and it’s available at

Thanks a lot for nice theme!!

I’m starting with it and replaced my old Wp site with Hugo. 🙂

Few questions:

1. what is required to get RSS link working? The link is [http://tld/atom.xml](http://tld/atom.xml) which gives 404 and I do not see any option to enable/configure RSS?
2. I’ve created Twitter widget and set ‘ut\_widget\_id’, but I only see ‘Status updating’ in the sidebar?

p.s. I forgot to add that I’m using 0.13master.

---

<div class="post-metadata">

**Author:** ![michael\_henderson](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/michael_henderson/32/10490_2.png) [@michael\_henderson](https://discourse.gohugo.io/u/michael_henderson)\
**Post date:** [March 12, 2015, 1:17am UTC](https://discourse.gohugo.io/t/theme-sshq/413/8 "2015-03-12T01:17:20Z")

</div>

I’ll look at the RSS and send a reply on that.

Are you having problems with Twitter running it locally or after you push it to your web host?

---

<div class="post-metadata">

**Author:** ![michael\_henderson](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/michael_henderson/32/10490_2.png) [@michael\_henderson](https://discourse.gohugo.io/u/michael_henderson)\
**Post date:** [March 12, 2015, 2:46am UTC](https://discourse.gohugo.io/t/theme-sshq/413/9 "2015-03-12T02:46:44Z")

</div>

@gour, I had the wrong file name in two of the partials. I’ve updated that and pushed to the master branch on Github. Thanks for letting me know.

---

<div class="post-metadata">

**Author:** ![gour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/gour/32/197_2.png) [@gour](https://discourse.gohugo.io/u/gour)\
**Post date:** [March 12, 2015, 8:13am UTC](https://discourse.gohugo.io/t/theme-sshq/413/10 "2015-03-12T08:13:21Z")

</div>

michael\_henderson [discuss@gohugo.io](mailto:discuss@gohugo.io) writes:

> Are you having problems with Twitter running it locally or after you  
> push it to your web host?

The problem is at the remote/production server.

---

<div class="post-metadata">

**Author:** ![gour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/gour/32/197_2.png) [@gour](https://discourse.gohugo.io/u/gour)\
**Post date:** [March 12, 2015, 1:46pm UTC](https://discourse.gohugo.io/t/theme-sshq/413/11 "2015-03-12T13:46:39Z")

</div>

michael\_henderson [discuss@gohugo.io](mailto:discuss@gohugo.io) writes:

> Are you having problems with Twitter running it locally or after you  
> push it to your web host?

Solved after I tried the site with Chromium…it was [Disconnect.me](http://Disconnect.me) which  
was blocking on Firefox. ☹

Sincerely,  
Gour

---

<div class="post-metadata">

**Author:** ![gour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/gour/32/197_2.png) [@gour](https://discourse.gohugo.io/u/gour)\
**Post date:** [March 15, 2015, 9:20am UTC](https://discourse.gohugo.io/t/theme-sshq/413/12 "2015-03-15T09:20:42Z")

</div>

I’m trying to add Piwik support to the theme and the config.toml get some new variables:

```
[Params.theme]
pw_tracking = "true"

[Params.piwik]
piwik_url = "piwik.domain.tld"
site_number = id

```

and in layout/partias/piwik/anaylitics there is following JS snippet:

```
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u = "//" + {{ $piwik_url }} + "/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', {{$site_number}}]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//piwik.domain.tld/piwik.php?idsite={{$site_number}}" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->

```

The value of {{ $site\_number }} template variable is referenced as intended, but, being total JS noob, can’t understand why the string concatenation in the line

```
var u = "//" + {{ $piwik_url }} + "/";

```

does not happen?

I’ve tried to change double quotes ("") into single ones (’’), as well as using concat() function, but same result.

Anyone can give some clue why the variable ‘u’ is not assigned the concatenation of the 3 strings:

- “//”

- value of $piwik\_url variable which is declared as:

- “/”

Of course, I’m open for any more elegant solution as well. 🙂

---

<div class="post-metadata">

**Author:** ![gour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/gour/32/197_2.png) [@gour](https://discourse.gohugo.io/u/gour)\
**Post date:** [March 15, 2015, 9:46am UTC](https://discourse.gohugo.io/t/theme-sshq/413/13 "2015-03-15T09:46:14Z")

</div>

gour [discuss@gohugo.io](mailto:discuss@gohugo.io) writes:

> I’m trying to add Piwik support to the theme and the config.toml get some new variables:

Too bad, the post went out truncated while the forum contains the  
complete one. ☹

---

<div class="post-metadata">

**Author:** ![michael\_henderson](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/michael_henderson/32/10490_2.png) [@michael\_henderson](https://discourse.gohugo.io/u/michael_henderson)\
**Post date:** [March 15, 2015, 3:02pm UTC](https://discourse.gohugo.io/t/theme-sshq/413/14 "2015-03-15T15:02:11Z")

</div>

> [@gour](#):
>
> var u = “//” + {{ $piwik\_url }} + “/”;

I think that it is at the wrong level. `{{ $xyz}}` is substituted in the Go template. That substitution is exact - it doesn’t include the quotation marks. Try

```auto
var u = "//{{ $piwiki_url }}/";

```

---

<div class="post-metadata">

**Author:** ![gour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/gour/32/197_2.png) [@gour](https://discourse.gohugo.io/u/gour)\
**Post date:** [March 15, 2015, 3:25pm UTC](https://discourse.gohugo.io/t/theme-sshq/413/15 "2015-03-15T15:25:06Z")

</div>

michael\_henderson [discuss@gohugo.io](mailto:discuss@gohugo.io) writes:

> I think that it is at the wrong level. `{{ $xyz}}` is substituted in the Go template. That substitution is exact - it doesn’t include the quotation marks. Try
> 
> ```auto
> var u = "//{{ $piwiki_url }}/";
> 
> ```

Thanks a lot. That works!!!..but still have to think a little bit to  
grasp it fully. 😉

---

<div class="post-metadata">

**Author:** ![michael\_henderson](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/michael_henderson/32/10490_2.png) [@michael\_henderson](https://discourse.gohugo.io/u/michael_henderson)\
**Post date:** [March 15, 2015, 3:40pm UTC](https://discourse.gohugo.io/t/theme-sshq/413/16 "2015-03-15T15:40:29Z")

</div>

One thing that will help is is time spent looking through errors. You’ll eventually get to where you recall seeing the exact same thing before.

Another thing that will help is to look at the output. Your output was something like:

```auto
var u = "//" + piwik.domain.tld + "/";

```

Couple of ways to fix that. My preference (obviously) was to put the template variable into the JS string directly. Another would be to change the definition to match the usage:

```auto
[Params.piwik]
piwik_url = "'piwik.domain.tld'"

```

That would result in:

```auto
var u = "//" + 'piwik.domain.tld' + "/";

```

Sometimes that will be the desired solution. The reason I prefer the first in this case is to avoid a needless concatenation at run time. Now if your script had something like:

```auto
var pTLD = {{ $piwk_url }};
var u = "//" + pTLD + "/";

```

Then you’d need the tics in your definition.

---

<div class="post-metadata">

**Author:** ![gour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/gour/32/197_2.png) [@gour](https://discourse.gohugo.io/u/gour)\
**Post date:** [March 16, 2015, 7:33am UTC](https://discourse.gohugo.io/t/theme-sshq/413/17 "2015-03-16T07:33:17Z")

</div>

michael\_henderson [discuss@gohugo.io](mailto:discuss@gohugo.io) writes:

> One thing that will help is is time spent looking through  
> errors. You’ll eventually get to where you recall seeing the exact  
> same thing before.

Thanks,

> Couple of ways to fix that. My preference (obviously) was to put the  
> template variable into the JS string directly.

But, isn’t hardcoding string into JS bad practice and make it  
invonvenient for other users wanting to use Piwik and make it  
configurable via Huho’s config file?

> Another would be to change the definition to match the usage:
> 
> ```auto
> [Params.piwik]
> piwik_url = "'piwik.domain.tld'"
> 
> ```

Do you find that’s acceptable option for Hugo’s config?

> The reason I prefer the first in this case is to avoid a needless  
> concatenation at run time.

I understand, but there is trade off to be made in configurability vs  
performance.

> Now if your script had something like:
> 
> ```auto
> var pTLD = {{ $piwk_url }};
> var u = "//" + pTLD + "/";
> 
> ```
> 
> Then you’d need the tics in your definition.

Well, I consider your original workaround more elegant.

Are you interested to include Piwik support in your theme?

---

<div class="post-metadata">

**Author:** ![michael\_henderson](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/michael_henderson/32/10490_2.png) [@michael\_henderson](https://discourse.gohugo.io/u/michael_henderson)\
**Post date:** [March 16, 2015, 7:52am UTC](https://discourse.gohugo.io/t/theme-sshq/413/18 "2015-03-16T07:52:03Z")

</div>

> [@gour](#):
>
> isn’t hardcoding string into JS bad practice and make it  
> invonvenient for other users wanting to use Piwik and make it  
> configurable via Huho’s config file

All the options use a value from the config file to create the output and the concatenation in this snippet isn’t really going to impact performance. You have a nicely named variable so it’s very readable any which way you choose to proceed.

Please go ahead and submit a pull request when you’re done and I can add it.
