csshexo

Hexo can not load style sheet


I just deployed a new blog using Hexo and it is failing when it tries to load the style sheet. The generated declaration in the index.html file looks like:

<link rel="stylesheet" href="/css/style.css">

I can solve the issue editing this file manually as follows:

<link rel="stylesheet" href="css/style.css">

Note how the / is removed. Is this a bug that hexo has or is this happening just to me. Here is my repo for reference: https://github.com/enriquezrene/quarkus

develop branch has the code master branch has the deployed website


Solution

  • I kinda solved the issue forcing to load the css file editing the head.ejs file as follows:

    ...
    <% if (config.highlight.enable){ %>
        <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
    
        <----- code added ----->
        <link rel="stylesheet" href="css/style.css">
        <----- code added ----->
    
      <% } %>
      <%- css('css/style') %>
    </head>
    

    However, this does not solve the issue completely since the generated index.html file now looks like:

    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="/css/style.css">
    

    So it will try to load the other file as well.