LouisBarranqueiro / hexo-algoliasearch

:mag_right: A plugin to index posts of your Hexo blog on Algolia
MIT License
133 stars 12 forks source link

link / permalink no sent to Algolia? #13

Closed mikecann closed 6 years ago

mikecann commented 6 years ago

Hey,

Im using your excellent tranquilpeak theme and noticed that the search result links dont work:

image

I did some digging and I think you rely on Algolia returning the post link but when I look at my Algolia index that information isnt there:

image

I cant see where in the code for this plugin you are supposed to be supplying that link / permalink to algolia.

Perhaps im doing something wrong. My root _config.yml looks like:

# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/

# Site
title: MikeCann.co.uk
subtitle:
description:
author: Mike Cann
language: en
timezone:

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://mikecann.co.uk
root: /
permalink: :category/:title/
permalink_defaults:

# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:

# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link: true # Open external links in new tab
filename_case: 0
render_drafts: false
post_asset_folder: true
relative_link: false
future: true
highlight:
  enable: true
  line_number: true
  auto_detect: false
  tab_replace:

feed:
  type: atom
  path: atom.xml
  limit: 20

# Home page setting
# path: Root path for your blogs index page. (default = '')
# per_page: Posts displayed per page. (0 = disable pagination)
# order_by: Posts order. (Order by date descending by default)
index_generator:
  path: ''
  per_page: 10
  order_by: -date

# Category & Tag
default_category: uncategorized
category_map:
tag_map:

# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss

# Search
# https://github.com/LouisBarranqueiro/hexo-algoliasearch#configuration
algolia:
  appId: "JYZJ63OX7U"
  apiKey: "--EDITED OUT--"
  adminApiKey: "-- EDITED OUT --"
  chunkSize: 5000
  indexName: "mikecann"
  fields:
    - title
    - tags
    - slug
    - excerpt
    - excerpt:strip
    - photos
    - gallery

# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page

# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: tranquilpeak

keywords:
- typescript
- game developer
- haxe
- c#
- programming
- travel
- drone
- photography
- england
- australia
- coder
- javascript

The only thing I can think that may be causing issues is the non-standard perma-link url or the usage of apex domain..

LouisBarranqueiro commented 6 years ago

šŸ‘‹ @mikecann , add permalink in the list of fields to index

E.g:

algolia:
  appId: "appId"
  apiKey: "apiKey"
  adminApiKey: "adminApiKey"
  chunkSize: 5000
  indexName: "indexName"
  fields:
    - title
    - tags
    - slug
    - excerpt
    - excerpt:strip
    - photos
    - permalink

I'm gonna update the documentation of the Tranquilpeak theme.

mikecann commented 6 years ago

@LouisBarranqueiro oh that makes sense! thanks!

LouisBarranqueiro commented 6 years ago

Cool! you're welcome! šŸ˜ƒ