Skip to content

Commit

Permalink
Using ghost api version 2 for searches
Browse files Browse the repository at this point in the history
  • Loading branch information
GodoFredo committed Jan 30, 2019
1 parent ad2088a commit 72b0ad4
Show file tree
Hide file tree
Showing 30 changed files with 129 additions and 50 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Logs
logs
*.log
*.ini

# Runtime data
pids
Expand Down Expand Up @@ -474,6 +475,4 @@ __pycache__/

.sass-lint.yml
.cache-loader
*.map
*.js.map
.src
yarn-error.log
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
Hi. I created this theme for ghost especially for you.
It is available for free so you can use on your site. It is strictly forbidden to use it for commercial use. If you have any suggestions to improve the theme, you can send me a tweet [@GodoFredoNinja](https://goo.gl/y3aivK)

## 🙏 Please, help me with a small donation [here](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Y7UB5Q8GVN3HN&source=url) or [PayPal](https://www.paypal.me/godofredoninja). It'll help motivate me to update the theme with many improvements
## 🙏 Please, help me with a small donation [here](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4H53Q4RTPSFQW&source=url) or [PayPal](https://www.paypal.me/godofredoninja). It'll help motivate me to update the theme with many improvements

[![donate](./donate.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Y7UB5Q8GVN3HN&source=url)
[![donate](./donate.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4H53Q4RTPSFQW&source=url)

![mapache theme for ghost](./screenshot.jpg)

Expand Down Expand Up @@ -70,6 +70,7 @@ You can see mapache in action on my Page [Demo](https://goo.gl/V7moIY)
- [4. Instagram](#4-instagram)
- [5. Comments](#5-comments)
- [6. Search](#6-search)
- [Setup a Custom integration](#setup-a-custom-integration)
- [Theme Translation](#theme-translation)
- [AMP](#amp)
- [Home Page](#home-page)
Expand Down Expand Up @@ -133,6 +134,22 @@ Mapache supports Disqus comments and Facebook comments as well as comment counti

The default search engine will only search the titles of the post

#### Setup a Custom integration

1. Go in your Ghost's dashboard -> Integrations -> Add custom integration
2. Set a name: GodoFredo Themes Search
3. Get the Content API Key and replace the demo key with this one
4. Get the admin domain. This will be different in some cases

```html
<script>
var searchSettings = {
key: 'ADD_YOUR_API_KEY',
host: 'https://demo.ghost.io',
};
</script>
```

The search engine that includes Mapache is very powerful, supports almost all languages and you can customize to your liking.

Read more about the search engine [Read More](https://github.com/HauntedThemes/ghost-search)
Expand Down Expand Up @@ -195,14 +212,16 @@ var facebookLocaleComments = 'en_US';
/* 06. Search Settings */
var searchSettings = {
key: 'ADD_YOUR_API_KEY',
host: 'https://demo.ghost.io',
/* This is optional */
options: {
keys: [
'title',
],
limit: 10,
threshold: -3500,
allowTypo: false,
},
/* This is optional to perform filtering of the ghost api */
api: {
resource: 'posts',
parameters: {
Expand Down
4 changes: 2 additions & 2 deletions amp.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
{{amp_ghost_head}}

{{!-- Google Fonst --}}
<link href="https://fonts.googleapis.com/css?family=Merriweather:400,700|Source+Sans+Pro:400,600" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Merriweather:400,700|Source+Sans+Pro:400,600,700" rel="stylesheet" />

{{!-- Style Custom --}}
<style amp-custom>.u-bgColor{background-color:#00a034}{{> "amp/amp-styles"}}.article-image img{object-fit: cover;object-position: top}</style>
<style amp-custom>.u-bgColor{background-color:#00A034}{{> "amp/amp-styles"}}</style>

{{!-- The AMP boilerplate --}}
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
Expand Down
6 changes: 3 additions & 3 deletions assets/scripts/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/scripts/pagination.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/scripts/prismjs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/scripts/search.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/styles/main.css

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions default.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<meta name="HandheldFriendly" content="True" />
<meta name="viewport" content="width=device-width, initial-scale=1">
{{!-- Styles --}}
{{!-- <link rel="stylesheet" type="text/css" href="{{asset "styles/main.css"}}"/> --}}
<link rel="stylesheet" type="text/css" href="{{asset "styles/main.css"}}"/>
{{!-- All Styles Compress --}}
<style>{{> "styles"}}</style>
{{!-- <style>{{> "styles"}}</style> --}}
{{!-- Font Roboto 400 --}}
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
{{!-- Ghost outputs important style and meta data with this tag --}}
Expand Down Expand Up @@ -55,6 +55,8 @@

{{!-- The main JavaScript --}}
<script src="{{asset "scripts/main.js"}}" defer></script>
{{!-- Content API --}}
<script src="https://unpkg.com/@tryghost/[email protected]/umd/content-api.min.js" defer></script>
<script src="{{asset "scripts/search.js"}}" defer></script>

{{#if pagination.pages}}
Expand Down
Binary file modified documentation/ghost-settings.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions error.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="{{lang}}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{t "Page not found"}}</title>

{{!-- All Styles Compress --}}
Expand Down Expand Up @@ -67,7 +67,11 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>

{{!-- The main JavaScript --}}
<script type="text/javascript" src="{{asset "scripts/main.js"}}"></script>
<script type="text/javascript" src="{{asset "scripts/main.js"}}" defer></script>

{{!-- Content API --}}
<script src="https://unpkg.com/@tryghost/[email protected]/umd/content-api.min.js" defer></script>
<script src="{{asset "scripts/search.js"}}" defer></script>

{{!-- Font Source sans Pro && roboto mono --}}
<script type="text/javascript">WebFontConfig ={google:{families:['Roboto+Mono:400','Ruda:400,700,900']}};(function(){var wf=document.createElement('script');wf.src='https://ajax.googleapis.com/ajax/libs/webfont/1.6.16/webfont.js';wf.type='text/javascript';wf.async='true';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(wf,s);})();</script>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "mapache-godofredoninja",
"description": "mapache theme for ghost by @GodoFredoNinja",
"demo": "https://godofredo.ninja",
"version": "3.0.4",
"version": "3.0.5",
"engines": {
"ghost": ">=2.0.0",
"ghost-api": "v2"
Expand Down
4 changes: 2 additions & 2 deletions partials/amp/amp-body.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
{{!-- Datetime --}}
<span class="timestamp">
<time class="datetime" datetime="{{date format='YYYY-MM-DD'}}">{{date published_at timeago="true"}}</time>
<span>{{t "in"}}</span>
</span>

{{!-- Category --}}
{{#if primary_tag}}{{#primary_tag}}
<span>{{t "in"}}</span>
<span class="categories"><a href="{{url}}" title="{{name}}">{{name}}</a></span>
{{/primary_tag}}{{/if}}
</div>
Expand All @@ -28,7 +28,7 @@
{{!-- featured image --}}
{{#if feature_image}}
<figure class="article-image u-block u-marginTop30">
<amp-img src="{{img_url feature_image size="m" absolute="true"}}" width="600" height="400" layout="responsive"></amp-img>
<amp-img src="{{img_url feature_image size="m" absolute="true"}}" width="600" height="400" layout="responsive" alt="{{title}}"></amp-img>
</figure>
{{/if}}

Expand Down
15 changes: 11 additions & 4 deletions partials/amp/amp-related.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@

{{#foreach posts}}
<div class="story">
<a href="{{url absolute="true"}}amp" class="story-link u-block u-relative">
<span class="story-border u-flexCenter u-absolute">{{@number}}</span>
<h3 class="story-title">{{title}}</h3>
</a>

{{!-- featured image --}}
{{#if feature_image}}
<figure class="story-image">
<a href="{{url absolute="true"}}amp">
<amp-img src="{{img_url feature_image size="s" absolute="true"}}" width="130" height="80" layout="responsive" alt="{{title}}"></amp-img>
</a>
</figure>
<h3><a href="{{url absolute="true"}}amp">{{title}}</a></h3>
{{/if}}

</div>
{{/foreach}}

Expand Down
12 changes: 6 additions & 6 deletions partials/amp/amp-sidebar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@
{{!-- Social media --}}
<div class="follow">
{{#if @site.facebook}}
<a href="{{facebook_url}}" target="_blank" rel="noopener noreferrer">{{> "icons/facebook"}}</a>
<a href="{{facebook_url}}" target="_blank" rel="noopener noreferrer">{{> "amp/icon-facebook"}}</a>
{{/if}}

{{#if @site.twitter}}
<a href="{{twitter_url}}" target="_blank" rel="noopener noreferrer">{{> "icons/twitter"}}</a>
<a href="{{twitter_url}}" target="_blank" rel="noopener noreferrer">{{> "amp/icon-twitter"}}</a>
{{/if}}

{{!-- Instagram --}}
{{!-- <a href="" target="_blank" rel="noopener noreferrer">{{> "icons/instagram"}}</a> --}}
{{!-- <a href="" target="_blank" rel="noopener noreferrer">{{> "amp/icon-instagram"}}</a> --}}

{{!-- Youtube --}}
{{!-- <a href="" target="_blank" rel="noopener noreferrer">{{> "icons/youtube"}}</a> --}}
{{!-- <a href="" target="_blank" rel="noopener noreferrer">{{> "amp/icon-youtube"}}</a> --}}

{{!-- Telegram --}}
{{!-- <a href="" target="_blank" rel="noopener noreferrer">{{> "icons/telegram"}}</a> --}}
{{!-- <a href="" target="_blank" rel="noopener noreferrer">{{> "amp/icon-telegram"}}</a> --}}

{{!-- SnapChap --}}
{{!-- <a href="" target="_blank" rel="noopener noreferrer">{{> "icons/snapchap"}}</a> --}}
{{!-- <a href="" target="_blank" rel="noopener noreferrer">{{> "amp/icon-snapchap"}}</a> --}}
</div>

</amp-sidebar>
Loading

0 comments on commit 72b0ad4

Please sign in to comment.