- year_titles = []
- months = years[year]
- for month in sorted(months.keys()):
- month_titles = []
- for day in sorted(months[month]):
- day_titles = []
- key = year, month, day
- if key in blog:
- for file, title, lead, tags in blog[key]:
- if file.endswith(".tmpl"): file = file[:-len("tmpl")] + "html"
- value = (year, month, day, file, title, lead)
- all_titles_tags.append((year, month, day, file, title, lead, tags))
- all_titles.append(value)
- year_titles.append(value)
- month_titles.append(value)
- day_titles.append(value)
- for tag in tags:
- if tag in all_tags:
- tag_links = all_tags[tag]
- else:
- tag_links = all_tags[tag] = []
- tag_links.append(value)
- write_template(3, year, month, day, day_titles)
- write_template(2, year, month, day, month_titles)
- write_template(1, year, month, day, year_titles)
+ year_titles = []
+ months = years[year]
+ for month in sorted(months.keys()):
+ month_titles = []
+ for day in sorted(months[month]):
+ day_titles = []
+ key = year, month, day
+ if key in blog:
+ for file, title, lead, tags in blog[key]:
+ if file.endswith(".tmpl"): file = file[:-len("tmpl")] + "html"
+ value = (year, month, day, file, title, lead)
+ all_titles_tags.append((year, month, day, file, title, lead, tags))
+ all_titles.append(value)
+ year_titles.append(value)
+ month_titles.append(value)
+ day_titles.append(value)
+ for tag in tags:
+ if tag in all_tags:
+ tag_links = all_tags[tag]
+ else:
+ tag_links = all_tags[tag] = []
+ tag_links.append(value)
+ write_template(3, year, month, day, day_titles)
+ write_template(2, year, month, day, month_titles)
+ write_template(1, year, month, day, year_titles)
+
+def by_count_rev_tag_link(tag):
+ """Sort all_tags by count in descending order,
+ and by tags and links in ascending order
+ """
+ return tag[:3]