Ghost-search (HauntedThemes) Help

Hi.

I have setup ghost-search (GitHub - HauntedThemes/ghost-search: A simple but powerful search library for Ghost Blogging Platform.) on my blog!

It works okay, but I have a problem… When I get the results there is no linebreak betwine the results.

2020-02-03_20-40-18

My widget at the top right corner is:

<!-- start widget -->
<div class="widget">
	<h4 class="title">Søg</h4>
	<div class="content">
	<input id="ghost-search-field">
	<div id="ghost-search-results"></div>
	</div>
</div>
<!-- end widget -->

Here is the script added to the footer

<script src="https://unpkg.com/@tryghost/content-api@1.3.4/umd/content-api.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/ghost-search@1.1.0/dist/ghost-search.min.js" integrity="sha256-yNPbNNfIwEJkDLzw2jUIQwqvwqjDIgc9rupcm4uqFqI=" crossorigin="anonymous"></script>

<script>
    let ghostSearch = new GhostSearch({
    url: 'https://www.geekblog.dk',
    key: '********** my code********',
    version: 'v3',
    input: '#ghost-search-field',
    results: '#ghost-search-results',
    button: '',
    development: false,
    defaultValue: '',
    template: function(result) {
        let collection = 'blog';
        let url = [location.protocol, '//', location.host].join('') + '/' + collection;
        return '<a href="' + url + '/' + result.slug + '/">' + result.title + '</a>';  
    },
    trigger: 'focus',
    options: {
        keys: [
            'title'
        ],
        limit: 100,
        threshold: -3500,
        allowTypo: false
    },
    api: {
        resource: 'posts',
        parameters: { 
            limit: 'all',
            fields: ['title', 'slug'],
            filter: '',
            include: '',
            order: '',
            formats: '',
        },
    },
    on: {
        beforeDisplay: function(){},
        afterDisplay: function(results){},
        beforeFetch: function(){},
        afterFetch: function(){}
    }
})
</script>

The code ^^ Its added to the Code injection → Site Footer

  • You can see my site here: https://geekblog.dk
  • What version of Ghost are you using? Last public version 3.**
  • What browser? Last version of firefox
  • What steps could someone else take to reproduce the issue you’re having? try to search in the right bar at the top

Regars

Thomas

You can do this using CSS.

<style>
#ghost-search-results a {
  display: block;
}
</style>
2 Likes

Thanks a lot - It works perfect now :slight_smile:

2 Likes