<commit_before>package site

// Render renders the site's pages.
func (s *Site) Render() error {
	for _, c := range s.Collections {
		if err := c.Render(); err != nil {
			return err
		}
	}
	return nil
}

func (s *Site) ensureRendered() (err error) {
	s.renderOnce.Do(func() {
		err = s.initializeRenderingPipeline()
		if err != nil {
			return
		}
		err = s.Render()
		if err != nil {
			return
		}
	})
	return
}<commit_msg>Render posts collection last<commit_after>package site

import (
	"sort"

	"github.com/osteele/gojekyll/collection"
)

// Render renders the site's pages.
func (s *Site) Render() error {
	cols := make([]*collection.Collection, 0, len(s.Collections))
	copy(cols, s.Collections)
	sort.Sort(postsCollectionLast(cols))
	for _, c := range cols {
		if err := c.Render(); err != nil {
			return err
		}
	}
	return nil
}

func (s *Site) ensureRendered() (err error) {
	s.renderOnce.Do(func() {
		err = s.initializeRenderingPipeline()
		if err != nil {
			return
		}
		err = s.Render()
		if err != nil {
			return
		}
	})
	return
}

type postsCollectionLast []*collection.Collection

func (d postsCollectionLast) Len() int {
	return len([]*collection.Collection(d))
}

func (d postsCollectionLast) Less(i, j int) bool {
	array := []*collection.Collection(d)
	a, b := array[i], array[j]
	switch {
	case a.IsPostsCollection():
		return false
	case b.IsPostsCollection():
		return true
	default:
		return a.Name < b.Name
	}
}

func (d postsCollectionLast) Swap(i, j int) {
	array := []*collection.Collection(d)
	a, b := array[i], array[j]
	array[i], array[j] = b, a
}
{'fraction_non_alphanumeric': 0.15316455696202533, 'fraction_numerical': 0.0006329113924050633, 'mean_word_length': 3.5959302325581395, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5581274', 'n_tokens_mistral': 606, 'n_tokens_neox': 571, 'n_words': 155}