In Jekyll, how can I generate year pages? - ruby

I'd like to be able to automatically generate by-year archive pages for every year in my blog history. That is, if I have at least one post from 2014, I'd like to be able to generate /archive/2014/index.html, and if I have at least one post from 2013, I'd like it to generate the page /archive/2013/index.html. Is there a way to do that in Jekyll?

Jekyll doesn't provide that feature by default. However, one of the most common plugins is jekyll-archives that is capable to generate post archives by dates, tags, and categories.
However, just keep in mind that this plugin is not supported if you are using GitHub pages as explained here. Actually, in the post itself you can see it is really hard that GitHub will ever support year or categories archives in general.

In case you can't use plugins (for example if you need your site to work on GitHub Pages), you can create one page that contains all years.
This is possible without plugins, for an example see Jekyll/Liquid Templating: How to group blog posts by year?.
If you absolutely must have a separate page for each year and still can't use plugins, there's another way if you're okay with generating a page with two lines of YAML front-matter for each year.
Here's an example where I'm showing how to create tag/category pages (separate page per tag) without using plugins.
It's not that difficult to create something similar for the years of post dates.

Related

Is there a list of all default urls/functions for magento2?

I have been working my way into Magento2 for quite some time. From time to time I find new URLs by accident - mostly when I Google for a function or feature.
So that I don't forget to style anything in a new store or also to test functions I would like to have an overview of all automatically created pages which can't be maintained in the backend.
As examples these URLs would be here:
/sales/guest/form
/contact
...
Should the whole be version dependent gladly from 2.4.0 and upwards

One-page AJAX-based WordPress site. How should I do it?

I am trying to create a one-page WordPress website, something like the ones you sometimes see in ThemeForest's WP section: the whole website is a long page that has everything in one place, from about us, to portfolio, to some blog posts, to contacts.
Placing all things on one page is not difficult. But when I started thinking about how to present individual posts and pages, I realised that I probably need a general way of getting posts' data via AJAX, and create new blocks with JS. How should I go about this? I suppose this was done before, but I struggle to find something this specific on Codex or a tutorial with best practices.
Any advice or link will be greatly appreciated.
You could use a plugin such as jQuery Easytabs, download it here, that has a built-in Ajax component.
I've found that the easiest way is to just get all content to load into the divs ahead of time, vs. trying to load all pages through Ajax. However, appending something like '?ajax/ajax' to the end of your urls through the Easytabs plugin is one option that I have successfully used in the past.
If you decide to use the easytabs functionality, there is ample documentation on the page that I linked to.

Magento custom fields on checkout

Is there any tutorial available for how do i add custom fields on front end check out step like PO number,Job name , customer comments etc as well as in admin->create->order.
My usual motto is to find (and buy if needed) a module that already has the functionality you seek. Especially when the life of this project involves version upgrades because then you can seek a pre-packaged solution from the provider.
I regret every bit of custom code I have added to our Magento install. Because now I've got to maintain the site to just keep working in addition to figuring out my hacks. Time to devote more time to replacing hacks with off-the-shelf extensions, which would have been much faster in the first place.
I know this attitude goes somewhat against the stack overflow thinking of I can do anything, but really, Magento's job is to enable someone to do less work.
Two years later, an update: after the gentle poke of a downvote (probably for appearing to shrug off the question), I am back to revisit and share some of what I've learned. The programming aspect of additional fields is the concept of persistence of the data.
If you're ok with the custom fields only appearing in the transactional emails following the order, then the task is as "simple" as adding the fields to the form somewhere and then updating the controller to to catch and insert the post data into the email. You can use a custom variable in the back end to readily expose this to the email templates. And a Magento SE on programatically creating a custom variable.
Getting persistence into the back end requires adding database fields via an installer in your module. The iCoreThink blog lays out the steps clearly and explains why, how to confirm your work, and then provides real-world implementation, like displaying to the customer in their account. The "other blog" mentioned below has a great example of this, though his example is specifically related to billing and shipping.
Resources from my upvotes and bookmarks:
» This iCoreThink blog post is my favorite reference so far and what I'm following now.
» I was using Templates Master's FireCheckout which includes their own checkoutfields module, but I've abandoned their single view checkout for the flow of Magento's one page checkout. I'm now trying to adapt their checkout fields (and use their controller) into my template for checkout.
» I thought for sure Alan Storm wrote an article about Checkout custom fields, but I don't see one.
» This Magento SE lists a couple blogs and a paid extension. The excellence blog is ok, but his style is too rote for me and I don't learn anything. The other blog discusses the procedure for building your module and installing the database fields.
» The unexpected-IT blog demonstrates and informal hack to add the code to core files (but sadly doesn't show how to override those files by copying them to app/code/local) and the steps to manually perform to get the column and fields added in the database. Apparently is perfect for 1.4 and below, but comments seem to explain what to do for 1.5 and up.
This last hack-ish change is my personal favorite as it seamlessly adds the extra bits into existing Magento admin pages and "feels like" less work. Caveats: I wouldn't do this without using version control and it will absolutely break if any core code changes happen between version upgrades.

From drupal to web2py: taxonomy/tagging and comments?

I have some sites that I implemented using Drupal. However as cool as Drupal is I've never been satisfied with coding in it mostly because it's in PHP and I've wanted to work with python. I've flirted with Django but I just recently discovered web2py and it's definitely caught my eye. Seems like it may be a sweet spot between Drupal and Django. Although django-cms is also on my radar.
So now I'm wondering how to re-implement my sites with web2py. Specifically suppose I have a site about DVD players. So in Drupal I'd have a CCK type DVD player, with various attributes. I guess this would correspond to a web2py model. How would I implement something like Drupal's taxonomy which is like a tagging system in web2py? Is there a module/plugin/appliance for that? Or am I manually creating the model schema to handle tagging?
Secondly, how would you handle something like comments and/or reviews on posts? Again, is there a pre-built plugin for this or do I have roll my own?
For tagging, I don't think web2py has anything quite like the Drupal Taxonomy module, but there are some options. First, you could create your own many-to-many model to assign tags to items. Another simpler option is to use web2py's list:reference field type to de-normalize the many-to-many relationship (the end of that section in the book includes a tagging example).
For existing tagging solutions, you can also check out web2py's plugin_wiki, which includes a tag widget. You can get it from the download page, or pull the source code directly. Another option is Powerpack, which includes the Instant Press CMS, which includes tagging and categories functionality.
Also, both plugin_wiki and Powerpack include comment plugins.
Finally, you'll generally get more and quicker responses from knowledgeable web2py users on the web2py mailing list.

Get at tags for blog posts programmatically

I wonder how to get at tags in blog posts (WordPress, Blogger, or Blogspot) programmatically (API, RSS feed, XML, other methods). Preferably a solution usable in Ruby on Rails.
See what the life streaming Rails apps such as kakuteru are using. Tagging across multiple Web2.0 style streams is important to kakuteru and I think they may employ a number of techniques. The also employ zemanta which has an API to generate tags from content. You can see zemanta's example of getting tags using ruby
If either of those have an API, i'd start by reading their documentation; outside of that; you can roll your own screenscraper (which is likely to be useless, given the amount of DOM content that is script generated these days)
Wordpress API
Blogger API

Resources