如何让hexo内容被其他人hexo 搜索引擎到

hexo下新建页面下如何放多个文章?
请问一下,在hexo中新建了page,想让这个page成为另一个文章目录,如何实现?也就是说我新建了一个叫随笔的新页面,我想在这个页面下放多个文章,怎么做?
使用Hexo的内建归档categories,应该可以满足题主所述要求。可以尝试以下方法(已自测成功,基于windows10+hexo3.0.1+):1.第一步:生成post(文章)时默认生成categories配置项:在根目录下scaffolds/post.md中,添加一行categories:。同理可应用在page.md和photo.md,示例如下:title: {{ title }}
date: {{ date }}
categories:
# 此处为添加内容
2.第二步:在实际写作时,在开头进行categories配置。例如:title: Hello,World!你好,世界!
tags: 写作
categories: 随笔 # 配置categories
这样在文章发布时,在git中使用hexo g命令,hexo会在根目录/public/categrises下自动生成归档文件夹,如图:3.第三步:配置博客首页归档展示样式。在主题配置文件themes/_config.yml中添加以下代码(#号后为注释内容):menu:
essay: /categories/随笔
# 博客首页展示文本/访问路径/自定义归档名称
write: /categories/写作
read: /categories/阅读
study: /categories/学习
code: /categories/编程
4.补充说明:如果发现博客首页展示文本为英文,需要改为中文显示,需要修改先博客根目录下的_config.yml文件的language配置,示例如下:# Site
title: My Blog
description:
language: zh-CN # 修改此处,一般默认为default.yml,原生英文显示
然后为实现文章归档名称显示为中文,接着再修改主题配置文件下language/zh-CN.yml即可,示例如下:title:
archive: 归档
category: 分类
home: 首页
archives: 归档
categories: 分类
tags: 标签
about: 关于
essay: 随笔
# 编辑代码时注意语法规范如缩进、空格等
read: 阅读
# Hexo采用yml语法,具体可自行搜索
write: 写作
5.最终展示效果(图中红框作强调用):6.点进某一归档分类如“阅读”,博客文章会依照归档配置,排序显示如下:7.参考:更多资料可以参考或者直接在上push issue。EOF.
这个得要主题支持吧……你可以去搜一个支持这个的主题
title: Jacman基于Pacman修改的Hexo主题date:
17:11:20categories: Hexodescription: Jacman 基于 Pacman 主题修改而来---## 前言由于Pacman已经暂停更新,加上Hexo已经升级为3.0,很多主题需要重新适配,而Jacman是基于Pacman修改而来,在前端设计样式和功能上做了很多合理的修改和完善,相信你也一定可以很快上手。&Jacman是一款基于Pacman修改并坚持更新的Hexo主题。---## 更新历史日 - 初稿阅读原文 - 扩展阅读- Jacman - - HelloDog Index - ---## 主题安装&设置很简单,请参考原文中文说明### Jacman---## 配置yml&这是我自己的真实配置文件,请参考原文注释做修改### 全局yml``` md# Hexo Configuration## Docs: ## Source: # Sitetitle: HelloDogsubtitle: Keep Calm and Carry Ondescription: HelloDog是一个基于Github和Hexo的静态Blog,希望用简单而清晰的写作方式Markdown分享自己的心得体会。author: wsgzaolanguage: zh-CNtimezone:# URL## If your site is put in a subdirectory, set url as '' and root as '/child/'url: root: /permalink: post/:title/permalink_defaults:# Directorysource_dir: sourcepublic_dir: publictag_dir: tagsarchive_dir: archivescategory_dir: categoriescode_dir: downloads/codei18n_dir: :langskip_render:# Writingnew_post_name: :title.md # File name of new postsdefault_layout: posttitlecase: false # Transform title into titlecaseexternal_link: true # Open external links in new tabfilename_case: 0render_drafts: falsepost_asset_folder: falserelative_link: falsefuture: truehighlight:
enable: true
line_number: true
tab_replace:# Category & Tagdefault_category: uncategorizedcategory_map:tag_map:# Date / Time format## Hexo uses Moment.js to parse and display date## You can customize the date format as defined in## date_format: YYYY-MM-DDtime_format: HH:mm:ss# Pagination## Set per_page to 0 to disable paginationper_page: 10pagination_dir: page# Extensions## Plugins: ## Themes: theme: jacman# Deployment## Docs: deploy:
type:# Othersindex_generator:
per_page: 5 ##首页默认10篇文章标题 如果值为0不分页archive_generator:
per_page: 0 ##归档页面默认10篇文章标题
yearly: true
##生成年视图
monthly: true ##生成月视图tag_generator:
per_page: 0 ##标签分类页面默认10篇文章category_generator:
per_page: 0 ###分类页面默认10篇文章feed:
type: atom ##feed类型 atom或者rss2
path: atom.xml ##feed路径
##feed文章最小数量```---### 主题yml``` md##### Menumenu:
主页 | Home: /
索引 | Index: /index
归档 | Archives: /archives
简介 | About: /about## you can create `tags` and `categories` folders in `../source`.## And create a `index.md` file in each of them.## set `front-matter`as## layout: tags (or categories)## title: tags (or categories)## ---#### Widgetswidgets:- category- tag- links- douban- rss## provide seven widgets:category,tag,rss,archive,tagcloud,links,weibo,douban#### RSSrss: /atom.xml ## RSS address.#### Imageimglogo:
enable: true
## display image logo true/false.
src: img/logo.png
## `.svg` and `.png` are recommended,please put image into the theme folder `/jacman/source/img`.favicon: img/favicon.ico
## size:32px*32px,`.ico` is recommended,please put image into the theme folder `/jacman/source/img`.
apple_icon: img/jacman.jpg ## size:114px*114px,please put image into the theme folder `/jacman/source/img`.author_img: img/author.jpg ## size:220px*220px.display author avatar picture.if don't want to display,please don't set this.banner_img: #img/banner.jpg ## size:1920px*200px+. Banner Picture### Theme Colortheme_color:
theme: '#ea6753'
##the defaut theme color is blue#### index post is expanding or notindex:
expand: false
## default is unexpanding,so you can only see the short description of each post.
excerpt_link: Read More #### Author informationauthor:
intro_line1:
"Hello, I'm OX. This is my blog on GitHub."
## your introduction on the bottom of the page
intro_line2:
"Try to do better."
## the 2nd line
## e.g. wuchong1014 or
weibo_verifier:
## e.g. b3593ceb Your weibo-show widget verifier ,if you use weibo-show it is needed.
Your weibo ID,It will be used in share button.
## e.g. wuchong1014 or your id for
## e.g. jark
## e.g. jarkwu for
github: wsgzao
## e.g. wuchong for
## e.g. imjark for
linkedin: aowang
## e.g. wuchong1014 for
google_plus:
## e.g. "" for , the "" is needed!
stackoverflow:
## e.g. 3222790 for ## if you set them, the corresponding
share button will show on the footer#### Toctoc:
article: true
## show contents in article.
aside: true
## show contents in aside.## you can set both of the value to true of neither of them.## if you don't want display contents in a specified post,you can modify `front-matter` and add `toc: false`.#### Linkslinks:
码农圈: ,一个面向程序员交流分享的新一代社区
Jark's Blog: #### Commentduoshuo_shortname: wsgzao ## e.g. wuchong
your duoshuo short name.disqus_shortname:
## e.g. wuchong
your disqus short name.#### Share buttonjiathis:
enable: false ## if you use jiathis as your share tool,the built-in share tool won't be display.
## e.g. 1889330 your jiathis ID.
tsina: ## e.g.
Your weibo id,It will be used in share button.#### Analyticsgoogle_analytics:
enable: false
## e.g. UA- your google analytics ID.
your google analytics site or set the value as auto.## You MUST upgrade to Universal Analytics first!## baidu_tongji:
enable: true
sitecode: c2c5fc7d844dabd87f49c3c ## e.g. e6d1f421bbc88f9ed37d1 your baidu tongji site codecnzz_tongji:
enable: false
your cnzz tongji site id#### MiscellaneousShowCustomFont: true
## you can change custom font in `variable.styl` and `font.styl` which in the theme folder `/jacman/source/css`.fancybox: true
## if you use gallery post or want use fancybox please set the value to true.totop: true
## if you want to scroll to top in every post set the value to true#### Custom Searchgoogle_cse:
enable: false
## e.g. :abnhpuysycw your Custom Search ID.## ## To enable the custom search You must create a "search" folder in '/source' and a "index.md" file## set the 'front-matter' as## layout: search## title: search## ---baidu_search:
enable: false
id: "2079376"
## e.g. "440642"
for your baidu search id
## your can change to your site instead of the default sitetinysou_search:
enable: true
id: 4ac092ad8d749fdc6293```---## 内容发布### 修改post预设格式&建议按照个人习惯修改`hexo\scaffolds`中的`post.md```` mdtitle: {{ title }}date: {{ date }}categories:description:```### 生成文章&文章如含有有中文请修改编码为`UTF-8`避免乱码1.命令生成初始文章,文件名空格会自动加`-`hyphen中横线``` bashhexo n "hexo post"```2.在`hexo\source\_posts`中编辑生成出来的`hexo-post`文件``` mdtitle: hexo post #可以改成中文的,如“新文章”date:
21:31:42 #发表日期,可自定义修改排序categories: blog #文章文类tags: [博客,文章] #文章标签,可以加入多标签---#这里是正文,用Markdown书写```3.本地预览文章内容,登录`localhost:4000`查看效果``` bashhexo s```4.发布内容到`public`文件夹,然后我选择手动复制同步到GitHub``` bashhexo cleanhexo g```### 导航栏添加自定义页面1.命令手动生成自定义页面``` bashhexo n page "about"```2.编辑`hexo/source/about/index.md`内容3.修改`themes/jacman/_config.yml`文件``` mdmenu:
关于: /about```---## 其它修改### RSS和sitemap1.安装RSS和sitemap插件``` bashnpm install hexo-generator-feed@1 --savenpm install hexo-generator-sitemap@1 --save```2.开启RSS和sitemap功能,编辑`hexo/_config.yml```` mdfeed:
type: atom
#feed 类型 (atom/rss2)
path: atom.xml
#在 rss 中最多生成的文章数(0显示所有)```3.修改`thems/jacman/_config.yml`,编辑Widgets和rss``` md#### Widgetswidgets:- rssrss: /atom.xml```4.手动提交生成出来的`atom.xml`文件给搜索引擎### 添加404页面在GitHub根目录下如``设置404.html即可,建议使用`腾讯公益404```` html&html&&head&&meta charset="UTF-8" /&&title&404 | HelloDog&/title&
&/head&&body&&/body&&/html&```### 网站统计Jacman自带的选择足够了### 站内搜索&已提交微搜索(swiftype也很不错)的Pull Request给Jacman,欢迎大家体验微搜索 - swiftype - ## 常见错误1. 修改配置文件时注意`YAML`语法,参数`冒号:`后一定要留` 空格`2. 中文乱码请修改文件编码格式为`UTF-8`3. GitHub同步慢或者失败请使用翻墙代理加速
应该是主题不支持...
已有帐号?
无法登录?
社交帐号登录将博客从jekyll迁移到了hexo
hexo和jekyll一样都是个静态网站生成工具,hexo是一个台湾小伙使用nodejs开发的,jekyll则是用ruby开发,github内置了jekyll,可以直接将jekyll相关的文件提交到github,github会自动给你生成静态页面。
hexo由于采用nodejs开发的,因此需要在本地生成静态页面后在提交到github,不过hexo内置了hexo deploy命令,提交博客也是挺方便的。
之前使用jekyll搭建的个人博客,由于jekyll对分页和文章摘要支持的不是很好,了解一下hexo这个新东西,感觉其页面生成速度还是蛮不错的,对分页和文章摘要也支持的挺好,主要是小清新的light主题吸引了我,于是乎,马上有种把博客迁移到hexo的念头。
首先需要安装nodejs,安装成功后,在命令行下通过npm install hexo -g安装hexo。
根据hexo官方文档,创建一个网站,生成页面,并通过hexo server本地查看网站,都挺简单的,不在铝恕
迁移jekyll到hexo
这个对于程序员就比较简单了,对比一下两种markdown文件的差异,写个程序处理一下就OK了,我用处理的,贴出代码:
using System.Collections.G
using System.IO;
using System.L
using System.T
using System.Text.RegularE
namespace Jekyll2Hexo
& & class Program
& & & & // 将jekyll中包含md文件的文件夹拖放到生成的exe上,处理后的文档保存在文件夹的上级目录
& & & & // 本程序是针对jekyll-bootstrap博客中的文档做的处理
& & & & static void Main(string[] args)
& & & & & & if (args.Length == 0)
& & & & & & {
& & & & & & & &
& & & & & & }
& & & & & & string folder = args[0];
& & & & & & if (Directory.Exists(folder))
& & & & & & {
& & & & & & & & foreach (var file in Directory.GetFiles(folder, &*.md&))
& & & & & & & & {
& & & & & & & & & & FileInfo fi = new FileInfo(file);
& & & & & & & & & & string date = fi.Name.Substring(0, 10);
& & & & & & & & & & StringBuilder sb = new StringBuilder();
& & & & & & & & & & FileStream fs = new FileStream(file, FileMode.Open);
& & & & & & & & & & using (StreamReader sr = new StreamReader(fs, Encoding.UTF8))
& & & & & & & & & & {
& & & & & & & & & & & & int lineCount = 0;
& & & & & & & & & & & & while (!sr.EndOfStream)
& & & & & & & & & & & & {
& & & & & & & & & & & & & & var line = sr.ReadLine();
& & & & & & & & & & & & & & if (line.StartsWith(&tagline:&))
& & & & & & & & & & & & & & {
& & & & & & & & & & & & & & & &
& & & & & & & & & & & & & & }
& & & & & & & & & & & & & & lineCount++;
& & & & & & & & & & & & & & if (lineCount == 1 || lineCount == 2 || lineCount == 4 || lineCount == 8)
& & & & & & & & & & & & & & {
& & & & & & & & & & & & & & & &
& & & & & & & & & & & & & & }
& & & & & & & & & & & & & & if (lineCount == 3)
& & & & & & & & & & & & & & {
& & & & & & & & & & & & & & & & sb.AppendLine(line.Replace(&\&&, &&));
& & & & & & & & & & & & & & & & sb.AppendLine(&date: & + date);
& & & & & & & & & & & & & & & &
& & & & & & & & & & & & & & }
& & & & & & & & & & & & & & if (lineCount == 5)
& & & & & & & & & & & & & & {
& & & & & & & & & & & & & & & & sb.AppendLine(&categories:& + line.Split(':')[1]);
& & & & & & & & & & & & & & & &
& & & & & & & & & & & & & & }
& & & & & & & & & & & & & & if (lineCount == 16)
& & & & & & & & & & & & & & {
& & & & & & & & & & & & & & & & sb.AppendLine(&&!-- more --&&);
& & & & & & & & & & & & & & }
& & & & & & & & & & & & & & sb.AppendLine(line);
& & & & & & & & & & & & }
& & & & & & & & & & }
& & & & & & & & & & // 保存处理后的md文件
& & & & & & & & & & File.bine(fi.Directory.Parent.FullName, fi.Name.Substring(11)),
& & & & & & & & & & & & sb.ToString(),
& & & & & & & & & & & & Encoding.UTF8);
& & & & & & & & }
& & & & & & }
遇到的一些问题
文章摘要设置
hexo和jekyll一样,都支持使用markdown编写文章,hexo的文章保存在source/_post目录下。
需要注意的是,在编写markdown文档是,在文档中插入&!--more--&就可以将文章切分开了,more以上的部分会已摘要的形式显示,当查看全文是more一下的部分也会显示出来。
图片路径问题
这个也很简单,直接将图片文件夹放到source目录下即可。
(window.slotbydup=window.slotbydup || []).push({
id: '2467140',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467141',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467142',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467143',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467148',
container: s,
size: '1000,90',
display: 'inlay-fix'

我要回帖

更多关于 hexo 百度站内搜索 的文章

 

随机推荐