Code Monkey home page Code Monkey logo

secondcrack's Issues

Pagination

Problem

While testing the new pagination, I discovered that, for pages index-2 and beyond, the "previous_page_url" and "next_page_url" values in $content were wrong. The actual index pages were fine, just not the array values for their link. I believe that I tracked down the culprit:

In engine/Post.php the function write_index_sequence sets a destination uri for the paginated index files:

    $dest_uri = substring_after(substring_before($dest_path, '.', true), Updater::$dest_path);

The problem is that when write_index_sequence is called in engine/Updater.php, it is passed a destination url like so:

    Post::write_index_sequence(  self::$dest_path . "/index", ....

Given a destination url in this form (/some/path/index), the $dest_uri construction fails because there is no '.' in the name.

The Fix

I changed that construction in engine/Post.php to the following and it seems to be working:

    $dest_uri = substring_after(substring_after($dest_path, '/', true), Updater::$dest_path);

Usage

Then to get the pagination working on the front page, simply set public static $frontpage_paginate = true; in engine/Updater.php. Then add the following to your main.php template file:

    <div id="prev_next">
        <span id='newer_posts'>
            <? if ( isset($content['previous_page_url']) && !empty($content['previous_page_url'])) echo "<a href='".$content['previous_page_url'] ."'>Newer Posts &gt;&gt;</a>"; ?>
        </span>
        <span id='older_posts'>
            <? if (isset($content['next_page_url']) && $content['next_page_url'] != end($content['next_page_url'])) echo "<a href='".$content['next_page_url'] ."'>&lt;&lt; Older Posts</a>"; ?>
        </span>
    </div>

I'm sorry not to do a pull request, but I made a mess of my local repo and I am new enough to git that I was afraid of messing things up. Plus, it was only one line.

License?

Thanks for releasing the source, Marco. I love some of the new ideas this is bringing to the table compared to some of the existing solutions out there.

Quick question - what license is this released under?

Editing post slugs unreliable

These are taken from Marco's own Readme. I figured I'd put them as issues that can be discussed, resolved.

"Editing slugs after publishing is unreliable."

Further information is welcome.

Tag pages should use numbered pagination, not monthly Archives

This will suck a little for performance when publishing a tagged post, but it will make tag-page browsing much better for visitors.

For now, not doing it for Type pages, since those are more likely to benefit from monthly Archive-style navigation and are much more common than tagged entries (e.g. Link type).

Feature Request: Slug override

Possibility to override post slug (and destination).

For example IMDb movie reviews, you could specify "slug: /reviews/movies/0379217" for review of Coffee and Cigarettes -review on your site.

Other use cases: automatically generated entries, twitter timeline mirroring ("slug: /twitter/[tweet id]").
You could check if the output folder has the entry.

Post hooks

Added hook capability to allow external hooks to be created to execute when a post is published. This will allow for things like posting to Facebook or Twitter.

Feature request: Process sub folders inside "pages" (and their contents)

Re: #12 "Feature Request: Slug override"

The folders inside pages-folder doesn't seem to process. This could be the answer to my original feature request.

I'm suggesting that:

/pages/reviews/index.txt -> example.com/reviews/index.html
/pages/reviews/movies/0379217.txt -> example.com/reviews/movies/0379217.html
/pages/tweets/[tweet id].txt -> example.com/tweets/[tweet id].html

This would solve the #12 feature request I submitted. Slug override would be a cool feature (the reason I didn't comment the original feat. request), but this way auto generated entries could be managed and tested if they exist already.

If index.txt hasn't been set, index.html would be auto generated and have a list of files, title as the link text.

Post archive may not reorder after post deletion

These are taken from Marco's own Readme. I figured I'd put them as issues that can be discussed, resolved.

"If you have a day with multiple posts, and you delete one of them in the middle, sometimes the others don't reorder themselves properly."

Further information welcome.

other extension than .txt?

Marco,

is there any special reason that you hardcoded the '.txt' extension for the input files?
Since they are markdown files, I would like sc to handle .md files.
If there's nothing against it, I would make the extension configurable in config.php and change the hardcoded '.txt'.

Best regards,
Stephan.

strtolower on slug

I just found out that sometimes the slog does not get set in lower case. How I found it:

  1. Create a post with not some letters not in lower case
  2. Published that post
  3. I have a hook that shortenes the url based on the $post['post-absolute-permalink'] variable
  4. The shortened URL pointed to the 'not all lowercase' post name / the site itself (the frontpage) shows the all lower case link (which works).

Hope this is accurate enough. I don't know where to search for the error. Maybe someone knows. Looking forward to a fix.

feature: github pages hook?

Was wondering if it is already possible to use github pages instead of dropbox sync so that after updating the pages it can automatically push the changes to the github pages page?

Month archives only show a few posts

These are taken from Marco's own Readme. I figured I'd put them as issues that can be discussed, resolved.

"The month archives sometimes only contain a few posts."

Further information welcome.

Support for Scheduled Publishing

I like to schedule a post for future publishing. I already implemented a fix on my own installation. Will get it ready and into a pull request soon.

Windows Support

This is exactly what I have been looking for. I am still having trouble getting it to work though, I really need to port this to work on Windows. Has anyone modified to work on Windows or can assist?

Zip Files

I've uploaded a .zip file to /media/2012/11/ and a .txt file within it was turned into a blog post without the zip file being manually extracted. I want to host this file but it returns a 404 when I try and link to it.

Does anyone know why this occurs and and how I can prevent it from happening?

Format change for Tag pages and RSS Feeds

currently, for tag foo the root directory is cluttered with:

tagged-foo.html
tagged-foo.xml

I propose this be changed to:

/tagged/foo.html
/tagged/foo.xml

which will help keep the home directory clean and organized.

Posting with bookmarklets

When I try to use the bookmarklets for "Draft Link", I keep getting the error:
"Drafts path doesn't exist: [/home/gibbz/Dropbox/blog/drafts]"

In reality, that folder does exist.

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.