• github
  • github page
  • gh page

  • 如何使用github+hexo+git+vercel弄一个hexo博客<重制版 上

    为什么又出来了一个 因为上一个太烂 估计看那个教程的都不行

    准备

    git 电脑 vercel账号 github账号

    vercel其实不用搞 他只是加速的

    开始

    在随便一个盘符 新建一个文件夹 进入文件夹 右键 选择 github bash here 之后最小化 不用管他 前往这里下载node 安装后 在github bash里输入

    node -v
    npm -v
    

    显示正常 不报错 证明安装成功 之后安装hexo

    npm install -g hexo-cli
    

    安装完之后输入

    hexo -v
    

    我的是手机 可能会不一样 img 显示正常 没报错就是安装好了 之后输入

    hexo init
    npm install
    

    稍等一会 因为我的手机npm不能用了 这里我就用cnpm img2 这个教程就到一半了 hexo最重要的就是主题了 这里我用yilia 因为他简洁 你想用其他的也是可以的 在博客主目录输入

    git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia
    

    弄好之后 我先歇会

    你还真翻了

    那我们继续 cd到博客根目录

    apt install nano
    

    安装nano

    nano _config.yml
    

    应该是这样的

    # Hexo Configuration
    ## Docs: https://hexo.io/docs/configuration.html## Source: https://github.com/hexojs/hexo/# Sitetitle: Hexosubtitle: ''description: ''keywords:author: John Doelanguage: entimezone: ''# URL## If your site is put in a subdirectory, set url as 'http://example.com/child' and root as '/child/'url: http://example.comroot: /permalink: :year/:month/:day/:title/permalink_defaults:pretty_urls:  trailing_index: true # Set to false to remove trailing 'index.html' from permalinks  trailing_html: true # Set to false to remove trailing '.html' from permalinks# 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:  enable: true # Open external links in new tab  field: site # Apply to the whole site  exclude: ''filename_case: 0render_drafts: falsepost_asset_folder: falserelative_link: falsefuture: truehighlight:  enable: true  line_number: true  auto_detect: false  tab_replace: ''  wrap: true  hljs: falseprismjs:  enable: false  preprocess: true  line_number: true  tab_replace: ''# 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 & Tagdefault_category: uncategorizedcategory_map:tag_map:# Metadata elements## https://developer.mozilla.org/en-US/docs/Web/HTML/Element/metameta_generator: true# 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-DDtime_format: HH:mm:ss## updated_option supports 'mtime', 'date', 'empty'updated_option: 'mtime'# Pagination## Set per_page to 0 to disable paginationper_page: 10pagination_dir: page# Include / Exclude file(s)## include:/exclude: options only apply to the 'source/' folderinclude:exclude:ignore:# Extensions## Plugins: https://hexo.io/plugins/## Themes: https://hexo.io/themes/theme: landscape# Deployment## Docs: https://hexo.io/docs/one-command-deploymentdeploy:  type: ''
    

    这里简单弄下 修改 theme: landscape 改成 theme: yilia deployment选项卡 改成

    # Deployment
    ## Docs: https://hexo.io/docs/deployment.htmldeploy:  type: gitrepo: https://github.com/YourGithubName/YourGithubName.github.io.git  branch: master
    

    这里先写到这里