Theme: SSHQ

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

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

I’ll send a push request for hugoThemes shortly.

3 Likes

@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.

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

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.

The analytics is mostly from @spf13’s example near the bottom 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?

[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.

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.

Thanks a lot for nice theme!!

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

Few questions:

  1. what is required to get RSS link working? The link is 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.

1 Like

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?

@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.

michael_henderson 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.

michael_henderson 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 which
was blocking on Firefox. :frowning:

Sincerely,
Gour

1 Like

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:

    {{ $piwik_url := .piwik.piwik_url }}

    within the template and

  • “/”

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

gour 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. :frowning:

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

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

michael_henderson 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

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

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

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:

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:

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

That would result in:

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:

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

Then you’d need the tics in your definition.

michael_henderson 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:

[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:

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?

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.