Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Commit

Permalink
Add Google Adsense widget
Browse files Browse the repository at this point in the history
  • Loading branch information
marcofranssen committed Oct 28, 2019
1 parent 9430724 commit ae5387c
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 8 deletions.
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Hueman
#### Probably the most beautiful theme for Hexo. [Preview](http://ppoffice.github.io/hexo-theme-hueman/)

> Probably the most beautiful theme for Hexo. [Preview](http://ppoffice.github.io/hexo-theme-hueman/)
![Hueman](http://ppoffice.github.io/hexo-theme-hueman/gallery/screenshot.jpg "")

> This theme is ported from [AlxMedia](https://github.com/AlxMedia)'s the WordPress theme [Hueman](https://github.com/AlxMedia/hueman).
> Special thanks to [AlxMedia](https://github.com/AlxMedia), who designed the original theme [Hueman](https://github.com/AlxMedia/hueman) for wordpress.
#### [View Documentation](https://github.com/ppoffice/hexo-theme-hueman/wiki)
**[View Documentation](https://github.com/ppoffice/hexo-theme-hueman/wiki)**

:star: It is strongly recommended that you read the docs before using Hueman.

## Features
Expand All @@ -25,11 +26,13 @@ Hueman inserts your blog categories into main menu in the header section. You ca
![](http://ppoffice.github.io/hexo-theme-hueman/gallery/main-menu.jpg "")

### Self-hosted Insite Search Engine

With the help of [Insight Search](https://github.com/ppoffice/hexo-theme-hueman/wiki/Search#insight-search), you can search anything inside your site without any third-party plugin.

![](http://ppoffice.github.io/hexo-theme-hueman/gallery/insight-search.png "")

### Custom Comment Services

Hueman supports several comment services, give you better choices to communicate with your readers.

![](http://ppoffice.github.io/hexo-theme-hueman/gallery/custom-comments.png "")
Expand All @@ -41,6 +44,7 @@ Hueman uses the `thumbnail` [front-matter](https://hexo.io/docs/front-matter.htm
![](http://ppoffice.github.io/hexo-theme-hueman/gallery/thumbnail.jpg "")

### Code Highlight

Hueman has more than 60 themes imported from [Highlight.js](https://github.com/isagalaev/highlight.js), and it is very easy to customize your own highlight theme.

![](http://ppoffice.github.io/hexo-theme-hueman/gallery/code-highlight.png "")
Expand All @@ -53,16 +57,20 @@ Hueman uses [lightgallery.js](https://sachinchoolur.github.io/lightgallery.js/)

### Sidebar

Hueman provides 6 built-in widgets:
Hueman provides 9 built-in widgets:

- recent_posts
- category
- archives
- catalog
- category
- google_adsense
- links
- recent_posts
- sticky_posts
- tag
- tagcloud
- links

All of them are enabled by default. You can edit them in `widget` setting.

### And so many new features to be explored...
### And so many new features to be explored

[View Documentation](https://github.com/ppoffice/hexo-theme-hueman/wiki)
6 changes: 6 additions & 0 deletions _config.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ customize:
# Widgets
widgets:
- catalog
- google_adsense
- recent_posts
- category
- google_adsense
- archive
- tag
- google_adsense
- tagcloud
- links

Expand Down Expand Up @@ -94,6 +97,9 @@ plugins:
lightgallery: true # options: true, false
justifiedgallery: true # options: true, false
google_analytics: # enter the tracking ID for your Google Analytics
google_adsense:
publisher_id: pub-5023539608753938 # enter the adsense publisher ID (pub-XXXXXXXXXXXXXXX) for your google adsense
ad_slot: 9596486949 # the id of your add unit
baidu_analytics: # enter Baidu Analytics hash key
bing_site_verification: # enter Bing verification key here
statcounter:
Expand Down
1 change: 1 addition & 0 deletions layout/plugin/google-adsense.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<script data-ad-client="ca-<%= theme.plugins.google_adsense.publisher_id %>" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
4 changes: 4 additions & 0 deletions layout/plugin/scripts.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@
</script>
<%- js('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML') %>
<% } %>
<% if (theme.plugins.google_adsense && theme.plugins.google_adsense.publisher_id) { %>
<%- partial('plugin/google-adsense') %>
<% } %>
<% } %>
20 changes: 20 additions & 0 deletions layout/widget/google_adsense.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div class="widget-wrap widget-float">
<% if (theme.plugins.google_adsense && theme.plugins.google_adsense.publisher_id) { %>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- huemen sidebar -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-<%= theme.plugins.google_adsense.publisher_id %>"
data-ad-slot="<%= theme.plugins.google_adsense.ad_slot %>"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<% } else { %>
<h3 class="widget-title">Sponsored</h3>
<div class="widget">
<a href="https://marcofranssen.nl?adsense_widget">This widget is sponsored by, Marco Franssen, main contributor to this theme.</a>
</div>
<% } %>
</div>

0 comments on commit ae5387c

Please sign in to comment.