zzossig / hugo-theme-zzo

Make a blog with hugo zzo theme!
https://themes.gohugo.io//theme/hugo-theme-zzo/en/
MIT License
738 stars 257 forks source link

Feature Request #154

Closed ghost closed 4 years ago

ghost commented 4 years ago

1. Support Google Tag manager (like Google Analytics)

2. support Google Adsense

image

paste code between </head> , then put ads.txt to your website root directory

3. Search Part

example here from hugo theme acdamic,when you type / (keyboard shortcut) , your cursor quickly into search bar.source code on GitHub

image

4. Add Terms and Privacy in footer,

image

5. Add Privacy pack :Show a cookie consent message to visitors

image

zzossig commented 4 years ago

Ok, this makes sense. I'll add all of them. But

when you type / (keyboard shortcut) , your cursor quickly into search bar.

I don't want to set a global key down event for the search. You do make a custom js file if you want the feature.

ghost commented 4 years ago

Ok, this makes sense. I'll add all of them. But

when you type / (keyboard shortcut) , your cursor quickly into search bar.

I don't want to set a global key down event for the search. You do make a custom js file if you want the feature.

Okay #154

6. add netlify.toml

[build]
  command = "hugo --gc --minify -b $URL"
  publish = "public"

[build.environment]
  HUGO_VERSION = "0.62.0"
  HUGO_ENABLEGITINFO = "true"

[context.production.environment]
  HUGO_ENV = "production"

[context.deploy-preview]
  command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"

[context.branch-deploy]
  command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"

[[headers]]
  for = "*.webmanifest"
  [headers.values]
    Content-Type = "application/manifest+json; charset=UTF-8"

[[headers]]
  for = "index.xml"
  [headers.values]
    Content-Type = "application/rss+xml"

[[redirects]]
  from = "https://zzo.netlify.com/*"
  to = "https://zzo.com/:splat"
  status = 301
  force = true
  # query = {path = ":path"}
  # conditions = {Language = ["en"], Country = ["US"], Role = ["admin"]}

redirects usage from netlify doc

zzossig commented 4 years ago

Netlify is not part of this project. But did you mean that I should make documentation on how to host a site using Netlify? It's documented here https://gohugo.io/hosting-and-deployment/hosting-on-netlify/#readout

zzossig commented 4 years ago

@LGTMXD I have a question. What's the benefit of adding Algolia? I just found that Algolia uses the instantsearch.js library and It's almost the same with the current search engine in the zzo theme. It adds complexity.

Since I don't want to manage the two search engines, I want you to explain the benefit of the Algolia. Why are you not satisfying the current search? How about I improve the current search instead of adding Algolia?

Regarding Google Adsense, you have to override the layouts folder to control the ads. For example, make this file to your partials folder.

{{ if and (not .Site.IsServer) (not ($.Param "disableAdsense")) }}
  <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
  <ins
    class="adsbygoogle"
    style="display:block; text-align:center;"
    data-ad-layout="in-article"
    data-ad-format="fluid"
    data-ad-client="ca-pub-xxxxxx"
    data-ad-slot="xxxxx"
  >
  </ins>
  <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
  </script>
{{ end }}

And then, insert this partial by overriding theme's layout folder.(so to speak, make your layout folder at your root directory and copy files from the theme's directory. that is the override) I don't think this doesn't have to be part of the theme. The user has to add it. I'll wait for your feedback. You can just type Chinese.

And I'm not currently using a cookie in the theme. What are you going to do with the cookies? Are you going to use a cookie? How? Why?

ghost commented 4 years ago

没有原因,就是想用。

zzossig commented 4 years ago

You can add google tag manager by setting googleTagManager parameter

...
googleTagManager = "" #GTM-XXXXXX

You can also add links to the footer by setting the below parameter

...
[[footerLinks]]
  name = "privacy"
  link = "https://..."
[[footerLinks]]
  name = ""
  link = ""
zzossig commented 4 years ago

I add 1,4 of your request. Regarding option2, you have to set it by your self. option3, I'm not going to add redundant search logic option5, we are not using cookies so we don't need the component.

So, I'm closing this issue now