inukshuk / jekyll-scholar

jekyll extensions for the blogging scholar
MIT License
1.13k stars 101 forks source link

Usage information? #1

Closed ghost closed 12 years ago

ghost commented 12 years ago

Hello,

I'm interested in using jekyll-scholar for my publications. Would it be possible to have more information on the usage of jekyll-scholar?

Thanks for your help. -- Hiren

ghost commented 12 years ago

I've got a basic setup done: https://ece.uwaterloo.ca/~hdpatel/uwhtml/publications/

Given that I'm making some changes to the generators and the tags, what is the best way for me to keep my fork in sync with your main repository?

I plan to make a simple template and allow others to use that simple template for doing publication lists the way I've done it.

inukshuk commented 12 years ago

This looks great! How did you decide to tackle the bdsk-file attributes then?

I think there are essentially two approaches to how we could package this: we could merge your tags and generators or we could try to isolate them so they can be used separately. The idea of jekyll-scholar was to be as general purpose as possible, which is to say it should not place any restrictions on bibtex-fields (like bdsk-file or public) etc. so it may be the better option to package your generators separately.

To do that, we could

That way, people could either just clone your fork or you could publish it as a ruby gem. Your gem pulls in jekyll/scholar so people who just want to use your generators/tags would only have to require your gem. In addition, we'd have to adopt proper versioning for the jekyll/scholar gem: that way we could make sure that your extensions don't pull in subsequent releases of jekyll/scholar that break the API.

What do you think?

ghost commented 12 years ago

I realized that it is easier for me to just make sure the PDFs exist where they need to be. Thus, I use the key (with _ replaced for : ) and store them in a particular directory. Somewhat of a naive/simple fix I suppose. It's also due to my unfamiliarity with Ruby.

I think the second approach sounds good. Although, I don't really know how to package my versions of the tags and generators as a gem such that it is independent of jekyll-scholar. I can try and look into it and see if there are resources available for it ...

ghost commented 12 years ago

Ah, just an additional issue that I've been facing:

inukshuk commented 12 years ago

I've pushed a new version of the details generator that sets priority to :high. I would think that the problem with the sitemap is that the sitemap generator was executed before the details generator. If that isn't the problem, I'll have to look at it more carefully.

About the packaging: basically, you can start a new repository called, for example, 'jekyll-scholar-extras' with the following directory structure:

lib/
 |_ jekyll/
     |_scholar/
        |_ extras.rb
        |_ extras/
            |_ your_generator.rb

In extras.rb you require 'jekyll/scholar' and 'jekyll/scholar/extras/your_generator'; in your generator you can include Jekyll::Scholar::Utilities to get access to #entries and the like.

You can copy the gemspec of jekyll-scholar, replace the name etc. and list jekyll-scholar as a dependency. That way, people could install jekyll-scholar-extras and the simply require 'jekyll/scholar/extras' in their plugin/ext.rb to get access to your generators.

ghost commented 12 years ago

I started a repository jekyll-scholar-extras, and I'm still working on it. However, how do I make sure that jekyll-scholar picks up my version of details_hdp.rb instead of the default one?

ghost commented 12 years ago

Also, the :high for the sitemap generator didn't fix the issue...

inukshuk commented 12 years ago

Hmm, you're right, with the generators its a bit tricky. I guess, I will change jekyll-scholar so that the details generator is not loaded by default. Thus, to enable it you'd have to require the file explicitly. I'll try to do that over the weekend and also take a stab at the sitemap generator.

With those fixes, I'd also suggest that I publish jekyll-scholar as 1.0.0. You can then define the dependency in your gemspec as ~> 1.0 and I will be careful not the break any of the utility interfaces for future 1.0 releases. Just put this line in your gemspec:

s.add_runtime_dependency('jekyll-scholar', '~> 1.0')

That way, you don't have to gem install jekyll-scholar explicitly when using the extras package.

ghost commented 12 years ago

I've added the runtime dependency and removed the explicit installation of jekyll-scholar. I'll update the generator code after your changes. And yes, including the details pages in the sitemap generated by the sitemap generator would be great. Thanks.

inukshuk commented 12 years ago

We'll have to adapt the sitemap plugin I think: as far as I can tell it generates the sitemap for regular pages by looking at the files before they are generated (not the posts) – obviously that doesn't work for the details generator (or other generators).

ghost commented 12 years ago

Alright. I'll try to take a look at it when I find some time. In the mean time, I'm still working on the extras and I have another question:

inukshuk commented 12 years ago

The utilities expose your bibliography in two ways: #bibliography and #entries. The former returns the entire bibliography object, the latter applies the query and sorts the results according to the settings in the config file. Therefore, using #bibliography you get unfiltered access and can then apply your own queries and/or sorting. As an example, take a look at the implementation of #entries.

inukshuk commented 12 years ago

Right, so I looked at the sitemap plugin again. Here is what you can do to get it to pick up the detail pages:

    path = File.join(page.subfolder, page.name)

    if File.exists?(File.join(site.dest, path))
      mod_date = File.mtime(File.join(site.dest, path))
    else
      mod_date = File.mtime(File.join(site.source + path))
    end

Insert this code in the generate_content method of the sitemap plugin. Also I just noticed that the author seems to have changed that method recently (you can basically skip the File.exists? tests in his new version) – anyway, this should probably be cleaned up so that the sitemap plugin works better with generated pages, but I thought I'd give you a heads-up in case you want to work this into you installation.

ghost commented 12 years ago
ghost commented 12 years ago

Thanks for your input on the sitemap plugin. I used what you gave me and started using the sitemap =)

Also, I am working on pages that are sorted by type too. Since I've added the feature of making a publication public, I needed to provide multiple and conditions to the query. Perhaps this would be useful for the jekyll-scholar itself get_entries(and_list)