Giter VIP home page Giter VIP logo

Comments (4)

raygit83 avatar raygit83 commented on May 28, 2024

Setting “Options +Indexes” instead of “Options Indexes” in the content directories’ .htaccess seems to at least help retrieving the file lists. However, the renderer still seems to fail retrieving the content given that the urls passed to get are lacking the /pages or /posts infixes.

EDIT: This seems to be related to #92 and I’m seeing the same type of directory listings as shown in #92 (comment)

from cms.js.

raygit83 avatar raygit83 commented on May 28, 2024

I have further debugged the issue and it seems it has to do with the way the index pages are structured by my server environment:

The getFiles function will enumerate all and push valid files into the this.files vector. However, the URL returned by getFileUrl is retrieved using getAttribute('href'), which in case is "somepage.md" instead of "pages/somepage.md" or "somedomain/pages/somepage.md", so file.getContent() in loadFiles() will fail retrieving the content later on.

I can fix this by manually adding the respective url prefix in getFiles(), e.g. by inserting var fileUrl = this.type + '/' + this.getFileUrl(file, config.mode); before if (isValidFile(fileUrl, config.extension)) { .. }. However, it seems that the correct fix would be configuring my server environment to output the index hrefs in the expected format.

Any hints on how Apache is expected to be configured (beyond than what can be found in the Wiki)?

Thanks!

from cms.js.

raygit83 avatar raygit83 commented on May 28, 2024

Okay, I see this is a duplicate of #36 .

However, it seems that the issue hasn't been fixed for good, so here is my proposal to allow for auto-detecting whether the server provides full or relative index path hrefs:

Insert the following snippet

var baseUrl = window.location.host.split(":")[0] || "localhost";
if(fileUrl.indexOf(baseUrl) === -1) {
  fileUrl = _this2.type + '/' + fileUrl;
}

between the lines

var fileUrl = this.getFileUrl(file, config.mode);

and

if (isValidFile(fileUrl, config.extension)) { ...

in the getFiles function.

from cms.js.

chrisdiana avatar chrisdiana commented on May 28, 2024

Thanks for finding this @raygit83 👍

from cms.js.

Related Issues (20)

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.