marcoarment / secondcrack Goto Github PK
View Code? Open in Web Editor NEWA static-file Markdown blogging engine.
Home Page: http://www.marco.org/secondcrack
License: Other
A static-file Markdown blogging engine.
Home Page: http://www.marco.org/secondcrack
License: Other
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.
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);
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 >></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'] ."'><< 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.
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?
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.
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).
hi.
my site http://sc.brite.biz/ is build with ur app.but i feel my site is deformed.how to correct it?
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.
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.
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.
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.
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.
I just found out that sometimes the slog does not get set in lower case. How I found it:
Hope this is accurate enough. I don't know where to search for the error. Maybe someone knows. Looking forward to a fix.
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?
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.
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.
Any plans to add in PHPDoc style documentation to the source code to give some idea of an API for the various classes?
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?
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?
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.