Code Monkey home page Code Monkey logo

hugo-theme-academic-old's People

Contributors

abahgat avatar artob avatar azeezx avatar beckerjohannes avatar benasse avatar bertbk avatar chen-gary avatar dancardy avatar dangkhoasdc avatar dominikvogel avatar dschuermann avatar gcushen avatar jpawlowski avatar kulla avatar marcschulder avatar momchil-anachkov avatar mylesjohnson avatar prateekkumarweb avatar rhewett avatar ronnychevalier avatar sbibauw avatar seisman avatar sparsick avatar stefanocecere avatar thomwiggers avatar tmieling avatar ultracoderru avatar valasek avatar yzyzsun avatar zertrin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

hugo-theme-academic-old's Issues

主题加速(外部库网址替换)

原因

以下API在**大陆访问不稳定,导致网站访问速度变慢:

  1. https://fonts.googleapis.com/
    报错:https://fonts.googleapis.com/css?family=Montserrat:400,700%7CRoboto:400,400italic,700%7CRoboto+Mono&display=swap
  2. https://cdnjs.cloudflare.com/ajax/libs/font-awesome/
  3. https://identity.netlify.com/v1/netlify-identity-widget.js

解决方法

替换上述API为国内镜像。值得一提的是,Academic主题中使用的外部库链接不是 hard write 在主题中的。这个主题更像是一个框架,最终生成的网站会用到哪些外部链接,取决于用户启用了哪些功能。这也使得我们很通过难预先下载被调用的库,来避免访问外部链接。

你可以通过比较main和api-cn两个分支来查看我做的修改,核心修改在commit: 48df1ffd2af2d2。我没有把接下来的每一步修改分开commit,这导致直接查看上述的核心commit比较困难。我下文提供的修改样例来自我另一个账号 @iGaryCC 的repo,请参考。

1. 替换 https://fonts.googleapis.com/

  • 替换 fonts.googleapis.com => fonts.lug.ustc.edu.cn (注:这步似乎并没有实际效果,仍会出现之前地报错。下一步更为关键)
    修改样例

  • 删掉config文件中应用fonts.googleapis的部分
    修改样例

2. 替换 https://cdnjs.cloudflare.com/ajax/libs/font-awesome/

替换 cdnjs.cloudflare.com => cdn.bootcdn.net (或 cdnjs.loli.net)
修改样例

3. 删除 https://identity.netlify.com/v1/netlify-identity-widget.js

直接注释掉(这个API的作用似乎是启用Academic主题内置的CMS,我们不会使用这个功能)
修改样例

Additional README

(中文)关于这个repo你可能想知道这些问题

1. 这个仓库是什么?

这个仓库是 Hugo academic theme 的一个fork,并且版本被退回至 commit id: 464a10d
(由于这个仓库与原仓库的发展方向完全不同,未来不会向原仓库提交PR,且为了更方便地添加说明文字,本仓库已由fork转换成standalone)

*选择退回这个版本是因为academic主题的开发者在这次commit前修复了一个感知明显的bug——导航栏明暗模式显示问题。并且目前 (2021.7.2) 这个主题新旧版在核心功能上没有太大差别,旧版也足够好用。

2. 为什么要建立这个仓库?

Hugo academic 主题的开发者对这个主题进行了一次比较大的改动。新版的Hugo academic 主题使用Hugo Modules,这使得搭建博客变得“更简单”,但也使用户几乎无法进一步定制这个主题,之后会举一个例子。而这个版本使用“传统的”Hugo themes,用户自由度更高。

3. 如何使用这个主题?

正如上面说的:这个版本使用“传统的”Hugo themes。所以只需:

  • 下载/clone这个repo至博客的themes/academic目录(如果clone,记得把文件夹重命名为academic,并删除.git
  • 复制exampleSite到博客根目录
  • hugo server预览效果
  • 修改&定制你的主页...

请注意,你需要确保你使用的是Hugo extended,这个主题在“hugo extended v0.83.1”上实测可用,更旧一些的版本应该也会可用,但一定要使用Hugo extended

4. 如何定制这个主题,有文档吗?

没有“直接的”文档。Hugo academic 主题的开发者把旧版的文档删除了,并且他们似乎在有意将自己与Hugo剥离(新版主题已经不附带指向Hugo官网的链接了)。

旧版和新版在feature上并没有很大差别(核心feature基本一致),新版的文档有很大的参考价值。

当然,我认为最快速的方法是直接阅读并修改exampleSite,里面提供的注释还算详细。

你需要修改的全部文件都在博客根目录的以下文件夹中:

  • config (很重要)
  • content
  • static

5. api-cn分支是什么?

原主题使用的部分api在**大陆访问不稳定,导致网站访问速度很慢。我将这些造成“访问速度慢”的api替换成了国内的镜像。具体修改请看这个issue

如果你认为访问你主页的人大多来自**大陆,请考虑使用api-cn分支的主题。

6. 这个主题适合哪些人?

新版academic主题做的很棒,按官方教程几乎对代码/命令没有要求,强烈建议大家试试。如果你仍然想要使用旧版主题,你可能是这样的人:

  • 首先,当然你想要搭建一个个人学术主页
  • 有一定使用Hugo的基础(没有基础的话可以参考Hugo官网的教程;也可以看我写的教程
  • 不介意折腾(因为没有文档)
  • 有自定义主题的需求
  • 补充上条,如果你想要修改主题中的部分api来达到提高地区访问速度的效果(参考/直接使用api-cn分支的主题)
  • 不急于使用最新的feature,不介意使用旧版

7. 这个仓库会更新academic主题的最新feature吗?

不会。。。前端也太难了吧😭

真的很感谢 Hugo academic theme 的团队,他们把这个主题开发得非常很棒。请访问他们最新的网站,看看他们提供的服务是否符合你的需求。

(English) You may want to know the following about this repo

Well... If you do not read Chinese, the key point is this repo is the old version of Hugo academic theme. Like other "traditional" Hugo themes, clone this repo to themes/ in the root folder of you blog, rename it to "academic", and delete .git. Then you are free to go.

This repo is tested in hugo extended v0.83.1, and you may expected it works in some other Hugo versions. But make sure you are using Hugo extended.

I have explained why you may need the old version of Hugo academic theme above in Chinese. If you really want to read the details, please try Google translate at this point. I will try to provide the English translation... Maybe... Or may not...

(As you found this repo, you have got your own reasons why to choose the old version right? 😏)

This repo is made standalone instead of a fork now. Since this repo parts ways with the original one and will not open any PR to the original repo, making it standalone allow me to add additional specifications easier.

I really want to thank the great work by the team of Hugo academic theme. Please check their new website, and see if that suits your needs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.