Comments (4)
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.
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.
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.
Thanks for finding this @raygit83 👍
from cms.js.
Related Issues (20)
- Allow to publish new content HOT 10
- markdown code area not correct HOT 1
- each page view requests all other pages HOT 5
- Split CMS.js file in to smaller parts HOT 9
- 1 day longer than normal
- Post list in example not displaying correct date
- Can't see any posts HOT 8
- Fix Google Crawler Issues HOT 2
- Can't put url on post metadata and pull them via the template engine HOT 2
- Gitlab Support HOT 1
- Feature Idea
- Support for websites without Indexing support HOT 6
- links replacing # with h1 due to markdown HOT 4
- null fileUrl causing errors
- Cannot read property 'split' of undefined HOT 3
- IE11 support / Object.assign() HOT 1
- Starter project not working
- Not working in NGINX
- Please add default dark theme
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cms.js.