ppoffice / hexo-theme-minos

A simple and retro styled Hexo theme, concentrated more on your ideas.
http://ppoffice.github.io/hexo-theme-minos
MIT License
765 stars 202 forks source link

May I know how to do SEO for your theme? #72

Closed hachi1030-Allen closed 5 years ago

hachi1030-Allen commented 5 years ago

Hi there,

according to search results online, most of the SEO documents are about the NEXT theme.

May I know how to do SEO in your blog theme?

Thanks!

Allen

ppoffice commented 5 years ago

@hachi1030-Allen SEO is a broad topic and Minos is not specially optimized for SEO. However, many SEO approaches used in other sites/themes are generic and can be applied to Minos as well. You can modify the layout files directly for this.

hachi1030-Allen commented 5 years ago

@ppoffice

Hi there, thanks for the reply.

I only have one question here, please check the below screen that from SEO document for NEXT theme:

image

It's trying to modify the title format for each document for SEO purpose. But I cannot find the similar code block in Minos theme. Can you show me how to apply this to your theme?

Thanks,

Allen

ppoffice commented 5 years ago

@hachi1030-Allen https://github.com/ppoffice/hexo-theme-minos/blob/master/layout/common/head.ejs#L2 https://github.com/ppoffice/hexo-theme-minos/blob/master/scripts/99_content.js#L55

hachi1030-Allen commented 5 years ago

@ppoffice

Thanks for the reply.

I have 2 questions about this:

  1. In the above screenshot that I shared with you, since it's the Next theme, so it's based on Swig file language format. Eg: {{ config.title }}{{ theme.description }}

    But in our theme, we are based on ejs, so your code will look like: <title><%= page_title() %></title>, may I know how can I modify to the same format which should indicates the title like "title - description", what's the calling function for the same as theme.description as the above code showed?

  2. I added the Keywords in the theme's _config.yml, such as below:

    image

But looks like it will not show up in the page's header with a meta tag named as keywords. May I know why this is happening?

BTW, I also said hi to you on Wechat, it will be better if you can reply that so that we can move this faster.

Thanks,

Allen

ppoffice commented 5 years ago

@hachi1030-Allen Description is here: https://github.com/ppoffice/hexo-theme-minos/blob/master/layout/common/head.ejs#L8 You just have to move it up to the title tag:

<title><%= page_title() %><%- get_config('description') %></title>

The keywords should be

keywords: Xamarin, Allen, Microsoft, Technical, .Net

And if you use different keywords for different post, you better add that to the post's front-matter.

hachi1030-Allen commented 5 years ago

@ppoffice

Cool. Thanks for the great information.

BTW, <title><%= page_title() %><%- get_config('description') %></title> , I saw you put the '-' before get_config('description'), should it be '=' as the page_title() or not?

Anyway I will try your solution tonight and get back to you.

Thanks a lot!

Allen