def obtain_archive_list(type, blockbydate = nil)

      article_url = Setting.get('articles_slug')
      category_url = Setting.get('category_slug')
      h = {}

      # if year
      if type == 'Y'

        # variables and data
        p = Post.where(:post_type => 'post', :post_status => 'Published', :disabled => 'N').uniq.pluck("EXTRACT(year FROM post_date)")

        if !p.blank?
          p.each do |f|
            h["#{article_url}/#{f}"] = f
          end
        end

        # if month
      elsif type == 'M'

        # variables and data
        p = Post.where("(post_type = 'post' AND post_status = 'Published' AND disabled = 'N') AND post_date <= CURRENT_TIMESTAMP").uniq.pluck("EXTRACT(year FROM post_date)")
        lp = {}


        if !p.blank?
          p.each do |f|
            lp["#{f}"] = Post.where("EXTRACT(year from post_date) = #{f}  AND (post_type = 'post' AND disabled = 'N' AND post_status = 'Published' AND post_date <= CURRENT_TIMESTAMP)").uniq.pluck("EXTRACT(MONTH FROM post_date)")
          end
        end

        if !lp.blank?

          lp.each do |k, i|

            if blockbydate
              h["#{article_url}/#{k.to_i}"] = k.to_i
            end

            i.sort.each do |nm|
              h["#{article_url}/#{k.to_i}/#{nm.to_i}"] = "#{get_date_name_by_number(nm.to_i)} - #{k.to_i}"
            end

          end

        end

      end

      li_loop(h)

    end
def obtain_archive_list(type, blockbydate = nil)

      article_url = Setting.get('articles_slug')
      category_url = Setting.get('category_slug')
      h = {}

      # if year
      if type == 'Y'

        # variables and data
        p = Post.where(:post_type => 'post', :post_status => 'Published', :disabled => 'N').uniq.pluck("EXTRACT(year FROM post_date)")

        if !p.blank?
          p.each do |f|
            h["#{article_url}/#{f}"] = f
          end
        end

        # if month
      elsif type == 'M'

        # variables and data
        p = Post.where("(post_type = 'post' AND post_status = 'Published' AND disabled = 'N') AND post_date <= CURRENT_TIMESTAMP").uniq.pluck("EXTRACT(year FROM post_date)")
        lp = {}


        if !p.blank?
          p.each do |f|
            lp["#{f}"] = Post.where("EXTRACT(year from post_date) = #{f}  AND (post_type = 'post' AND disabled = 'N' AND post_status = 'Published' AND post_date <= CURRENT_TIMESTAMP)").uniq.pluck("EXTRACT(MONTH FROM post_date)")
          end
        end

        if !lp.blank?

          lp.each do |k, i|

            if blockbydate
              h["#{article_url}/#{k.to_i}"] = k.to_i
            end

            i.sort.each do |nm|
              h["#{article_url}/#{k.to_i}/#{nm.to_i}"] = "#{get_date_name_by_number(nm.to_i)} - #{k.to_i}"
            end

          end

        end

      end

      li_loop(h)

    end
Returns a list of the archives
 Params:
 +type+:: has to be either Y (year) or M (month)