Giter VIP home page Giter VIP logo

cms.js's Introduction

Hi there ๐Ÿ‘‹

๐Ÿ”ญ Iโ€™m currently working on ...

๐Ÿ“ซ Subscribe for updates on new projects and releases.

cms.js's People

Contributors

butuzgol avatar chrisdiana avatar codeglaze avatar dotnetcarpenter avatar gitter-badger avatar maksyms avatar maybegeek avatar nimag42 avatar overlandandseas avatar rimselis avatar yuansheng1989 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cms.js's Issues

Order of posts list wrong?

I really like CMS.js, but there is one thing holding me back from using it in place of a normal blog CMS. I like the most recent post to be at the top of the page, but with CMS.js, the most recent is at the very bottom of the page. This really isn't user-friendly as it means viewers have to scroll all the way down to the bottom to see the latest posts, with the older posts just wasting screen real estate up at the top.

Is there a way to fix this? Can I change the order of the posts somehow?

setNavigation() is invoked before all pages are loaded

When loading several pages, I have noticed that my navigation bar (.cms_nav) was lacking some links. My guess, the reason for that is that the end of content load is compared with page count using an ID-like-variable, not an actual counter.

Short explanation

Pages are loaded asynchronously and the "counter" (value that is accessed by Ajax success) is passed by iterating the filenames in getFiles(). The navigation bar is loaded when the counter is equal to the count of the pages. There can be a situation where a last page is loaded first and the navigation bar is created prematurely.

Long explanation

Load flow goes like this:

  • CMS.getFiles(type) is invoked at line 428 where type === 'page'
  • Inside getFiles(type) Ajax call is performed to get files in the directory
  • On success .md filenames are extracted
  • For each file CMS.getContent() is invoked at line 350 with iterated "counter"
  • Each file is fetched in CMS.getContent() using an Ajax call
  • On success 'parseContent()' is invoked passing a "counter"
  • If counter === numFiles (i.e., if the "counter" of the file is the same as the count of files), the CMS.contentLoaded() is invoked (at line 245) and (if posts are loaded already), navigation bar is loaded

This means, that if the last page (alphanumerically on the getFiles() Ajax load) is loaded first, then counter === numFiles is true, and the navigation is not loaded properly.

Replication

Create pages A.mb, B.mb and C.mb. Make A substantially larger so it would load last. Navigation bar should only contain C (and maybe B) and not A.
Make sure to clean the cache.

CLI Utility

It would be great to have a CLI utility to start a project (in addition to how it is set now with cloning). Thanks for the suggestion @ButuzGOL!

Maybe something like:

npm install -g cms.js
cms.js init
git push

CLI utility

I'm not entirely sure how difficult this would be to create, or maybe it could just as easily be done as a .BAT file, but I think it'd be pretty cool to have some sort of simple script that if you did:

$ cmsjs new post 'Post Title Here'
-or-
$ cmsjs new page 'Page Title' pageTemplate

it would automatically create a new blank document in the appropriate folder (/posts or /pages), while also passing the appropriate variables into both the file name itself (if needed; posts would have the file creation date inserted) and into the front matter (pages would have a template defined).

Pages might be a little bit more difficult to set up properly, as you would probably want to include a way to insert a navigation item into the array in js/config.js, so maybe you could have something like:

$ cmsjs new page 'Page Title' pageTemplate navName targetWindow

...or use the page title as navName, and just drop that variable from the string above. targetWindow would be set as "blank" or "self", allowing navigation links to be opened in a new or same tab.

Anyways, I'm not sure how difficult something like this would be to implement, but it could be useful for people who expect to be doing a lot of publishing to their cms.js-powered site. I personally plan to use it to keep track of daily notes and logs of a project I'm working on. I don't require anything robust or feature-packed, just something quick, simple, and unobtrusive like cms.js.

In this issue, @ButuzGOL suggests porting cms.js to NPM. According to some reading I've been doing, CLI tools can also be created in Node.JS, which to me, makes the idea of a CLI tool for cms.js even more legit.

Thoughts?

jQuery as a Dependency

I'm almost through with recoding cms.js to not rely on jQuery. Would that be something that I could attempt to merge, or should I keep that one on my own branch?

The main reason I ask is that some of my code replacements relies on ES6 which is fully supported in current browsers but is relatively new and may not work in older browsers.

I did already merge one piece of code for that which is a new way to do for: 'for (this of that)'.

Anyway, it's significant enough that I also wanted to get some opinions as I know while there would be advantages to not requiring jQuery that there may be reasons people want it to stay.

create own themes

  • create own themes
  • directory structure for own themes
  • ajax for getting the template.tpl

Hi there and nice to see @cdmedia back on track!

(As I'm not javascript-savvy enough, I'd rather try it with words.)

It would be nice to have theme support. A variable in config.js named theme = '' (default empty) could be set to the name of a directory in the newly created directory theme.

The structure of a theme would be a css directory and a file template.tpl. For example the default theme would be a directory css with poole.min.css and style.css in it and a file called template.tpl which includes the things we need for a own template. I'm unclear of how much we can put out of the index.html to the template, the css part in the <head> element? ...

In the config.js the variable would allow a corresponding ajax to get the themes/THEME/template.tpl and var tpl would get the individual themes content.

This would definitively allow more flexibility.

thanks

1 day longer than normal

the code

function p(t) {
    var e = new Date(t);
    return e.setDate(e.getDate() + 1), [e.getDate(), e.getMonth() + 1, e.getFullYear()].join("/")
}

should be

function p(t) {
    var e = new Date(t);
    return [e.getDate(), e.getMonth() + 1, e.getFullYear()].join("/")
}

add <meta name="keywords">

Hi there,

should we add <meta name="keywords" content="foo"> to the <head> of the index.html or possibly to template.tpl (if we would include such an option, see #74).

As a bonus, we should allow author: x, description: y and keywords: z as structured input via yaml in the pages and posts md files.

thanks

The date parsing is very brittle

On line 331 in cmd.js the date parsing looks like this:

file.date = new Date(filename.substring(0, 10));

With a filename like /posts/2016-01-01_example-post.md the result is "/posts/201" - hardly a parsable date.

Github Personal pages broken (ish)

First of all, great project! I was looking for something just like this for a while for my personal blog.

I was setting it up according to the instructions, but I came across an issue. According to the user pages docs, these use the master branch instead of gh-pages.

cms.js still tries to use gh-pages for the posts though, because it only knows whether it's in Github mode or not and makes no distinction between personal and project pages.

So github is serving master for files (including config.js), but cms.js queries the gh-pages branch for posts. This can be remedied by keeping a copy of master in gh-pages, but it sounds like a specific case that should be catered for.

Keep up the good work!

Workflow

So is the idea that you set the configuration and modify your theme in the master branch, and write your posts in the gh-pages branch?

It's the master branch that is served by Github but cms.js gets posts from gh-pages branch?

Make a simple theme for cms.js

I made a simple theme, but I found some problems, such as the article list page, should not put the markdown into HTML, To my understanding, should select only p, filter out the img, h1...
The other question, in the article doesn't support HTML input, such as < p style = "XXXX" > < / p >

https://github.com/hi-caicai/cms.js-themes

markdown and yaml front matter conflict

I didn't see anything about this in other issues. I have a habit of using the underlined h2 style in markdown.

like this
---------

I was getting some strange errors that I figured out has to do with the parseSeperator string in the settings object. I made a fix in parseContent method. I honestly don't even know if this is a real problem for other people, or just me. Am I doing something weird?

Handle layout tag

Handle 'layout' tag in posts header (currently it's ignored).
Allowable values seem to be (from samples): 'default' and 'post'.

Add SEO Friendly Tags

Nice and Light Weight Project Better have SEO Friendly Tags like
change `titlle , meta keywords, meta descriptions' on each page load.

Fix for blog/static frontpage and posts listing

This is a note for @maybegeek's PR #30. There was some conflicts that cause rendering to break so I had to revert momentarily. I'll make sure to merge your fix in once they are ironed out.


default: frontpage = '' = blog
user option: blog not on frontpage, instead page as frontpage, listing of posts defaults to #posts in that case
user option: blog not on frontpage, instead oage as frontpage and in the config user can choose an url for the listing: #mypostings

Architect changes

Currently I like how it starts

  1. git clone
  2. git push to your project

But then I thought about to move marked and jquery as deps using npm
So I get

  1. git clone
  2. npm install
  3. move files from node_model to lib
  4. git push

Also I thought about steps

  1. npm install -g cms.js
  2. cms.js init
  3. git push

I thought about it because

  1. break project to sep files
  2. use babel
  3. min sources
  4. write test
  5. use dependancy manager
  6. new features for project how to update own project

what do you think ?

Neocities

HI - Great App, thanks for the job !

I would like to ask if there is a way to use cms.js without htaccess/apache, because i would like to use it with a free neocities.org account.

Don't know if neocities use apache, but if they do, with a supporter account we can upload restricted files maybe like htaccess.

Cheers - nibreh

Separate Template for posts on homepage and on post page

Could we have a separate template for posts on the homepage? I have a certain layout I want there and a different layout I want when a user visits the actual post page.

Edit: I figured out how to implement this with only a 4-5 additional lines of JavaScript. #56 is the PR with those changes. Sorry, I didn't realize how easy it was to add that functionality until after I posted this issue!

add class to currently viewed navigation item

Hi there,

our navigation could get more styleable, if we had a class value (e.g. current) for the currently viewed item:

<a ... class="cms_nav_link current" ... >

  • For the pages we would have currently viewed page title == menu item title
  • We also would have to check for static front page and the list view of posts (which could have a own static page), as well as decide if we want to add a class value (perhaps current-parent) to the menu item in which the posts are, even if they are viewed in single view.

thanks

CI

I miss some CI config. We coukd run the linting for every commit and PR.
I suggest using Travis CI.

cms.js is not a CMS, please rename it.

Please, don't name it cms.
cms.js do not let the user manage it's content.
The content is managed outside (by a text editor).

Every CMS provide:

  • server side to store the data
  • backend to write the content
  • front end to let visitor view the content

CMS.js provide:

  • tools to transform text into web page using theme.

So it is not a CMS.
https://en.wikipedia.org/wiki/Content_management_system

I would recommend to change the name.

file.name already has the url folder

On line 267 in cms.js file.name already has the url folder but url is made up by concatenating urlFolder + '/' + file.name;. The result is posts//posts/2016-01-01_example-post.md which seems to be an error.

Render blocking question

I'm liking this as a system quite a bit, but have mixed feelings (or maybe just confusion) about the impact of taking a content site (vs app) and blocking immediate render. Is there a work-around for people who share this concern?

screen shot 2016-01-22 at 11 29 55 am

SEO?

Many people use a cms or something like Jekyll for the SEO value. With this having no server to render pages, nothing will be indexed. Any solutions for this as it's a cms?

security: config.js open to the world

Thanks for this great package! Something I have been looking for for a long time :)

However, it occurred to me that config.js is open to the world, so anyone can read my github credentials by pointing their browser at js/config.js. Or am I missing something here?

Changing the file permissions from 644 to 640 doesn't work (blank screen), even when I change the file's group to www-data.

Any suggestions?

pages and htaccess issue

This is cool, I wish I could get it working on my web hosting account. CMS.js always reports that something went wrong, and to check config.js for the pages directory and .htaccess.

But I never changed the name of the pages directory, and the .htaccess from the download is present in that directory without modification. The mode is set to Apache.

Putting in the whole path like http://www.mywebhost.com/pages into config.js doesn't work either.

Support for NGINX

Maybe this is a silly question, but I don't see anywhere explicitly stated that there is support for nginx. Because I use nginx on my server I tried to make it working: I used the Apache Mode and then included in my configuration of nginx something like this:

server {
        listen 80;
        root "path to the directory of files";
        index index.html index.htm;
        server_name "name of the virtual host";

        location / {
                try_files $uri $uri/ /index.html;
                autoindex on;
        }
}

The important line is the instruction autoindex on, without it the web page displays an error.
Everything seems working fine.

Date in .md not file date

I noticed CMS.js uses file creation/modification date to order posts. Is there any chance to use Date field in .md file to do so?


---
layout: post 
title: post title
date: 20160729

---

Line endings

This did not work on my windows machine due to different line endings,

I changed this

to var infoData = data[1].split(/[\n\r]+/);

I think that should cover all cases but have not tested

Looking for collaborators...

Hey all first I want to say thank everyone who has contributed to the project. It's been awesome getting to see this thing grow. I've been MIA for a while and I apologize for not being as involved as I would like. That being said, if anyone is interested in helping administer PRs/testing/QC on CMS.js please send me a PM or email [email protected]. I really don't have the time right now to contribute but would really like to keep this alive and possibly jump back in once some time is freed up.

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.