Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Bookmarklet to swap between GitHub Pages and local pretzel instance #290

Open
idvorkin opened this issue Dec 25, 2015 · 8 comments
Open

Comments

@idvorkin
Copy link

I love pretzel, it's a great way to use static blogs on windows - THANK YOU for creating it!

I'm not sure if this is helpful to others, if it is, I'm not sure where to stick it, so creating an issue to have the discussion.

For reasons I don't yet understand, navigation works better in my GitHub pages (GHP) blog, then in my pretzel blog. Thus I navigate on GitHub Pages and then swap the URL to my local instance. I do this using the below code converted to a bookmarklet. Lastest code as gist :

function swapLocalRemoteBlog() { 
    /*
     * Pretzel renders, but doesn't navigate the same as github pages (GHP).
     *  Thus use GHP to navigate, then use this bookmarklet to swap with local pretzel blog.
     */
    var currentUrl = document.URL;
    var errorMessage = "Only works on Igor's Blog"; 
    var githubBlogURL =  "http://idvorkin.github.io";
    var localPretzelBlogUrl =  "http://localhost:8080";
    var newUrl = "";
    if (currentUrl.startsWith(githubBlogURL)) {
        newUrl = currentUrl.replace(githubBlogURL,localPretzelBlogUrl);
        /*pretzel can't have a trailing slash - Issue 289, so remove it*/
        newUrl = newUrl.substr(0, newUrl.length-1)
    } else if (currentUrl.startsWith(localPretzelBlogUrl)) {
        newUrl = currentUrl.replace(localPretzelBlogUrl,githubBlogURL);
    } else {
        alert(errorMessage);
        return;
    }
    window.location = newUrl;
};
swapLocalRemoteBlog();
void(0);
@thoemmi
Copy link
Contributor

thoemmi commented Dec 26, 2015

In what way does pagination not work with Pretzel? It works fine on my site.

@idvorkin
Copy link
Author

RE: Pagination, I wasn't clear:

Several things aren't working locally on my site. Some of those things are certainly my fault, :) Others I'm logging bugs for as I debug them (e.g #289).

If you clone and run my site locally, you'll see no posts showing up on the main page, even though it works fine on GitHub pages. I assumed the problem was pagination, but it's quite possibly another issue.

I'll update the description in this issue, and log bugs for the other issues as I debug more.

@laedit
Copy link
Member

laedit commented Dec 28, 2015

Thanks! 😄
Pretzel was created years ago but since there are only few people who are still maintaining it, so we are far from having all features of Jekyll. And sadly I can't promess you that one day it will.
But we can still have a minimum of working stuff. 😃

What version of pretzel have you tried?
Builded from the source or from chocolatey?

@idvorkin
Copy link
Author

I'm grateful for chocolatey even if you never make a single improvement :) Having single page rendering is very valuable for me, as it lets me write/edit/debug my styling/posts on windows, and only fire up a linux vm when I'm messing with pagination or complex navigation goop.

I use chocolatey today, but I can build from source if you recommend that.

@thoemmi
Copy link
Contributor

thoemmi commented Dec 28, 2015

@idvorkin RE: pagination: you have to specify paginate: 5 in the frontmatter of your file. I cloned your repository, added paginate: 5 to index.html, and it worked.

@idvorkin
Copy link
Author

@thoemmi - Huge thanks for making the effort -- that was incredibly helpful. Is there something obvious to fix tags as well?

From:

http://localhost:8080/tags/

failed

@laedit
Copy link
Member

laedit commented Dec 28, 2015

If you use the Chocolatey version please specify the version 0.3.0 when you install pretzel, it's the last version but hasn't been validated by chocolatey moderators yet.

@laedit
Copy link
Member

laedit commented Dec 29, 2015

The version 0.3.0 has just been validated, you only need to do:

cup pretzel

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants