~will-clarke/super-simple-static-site-generator

201cb90b6046f5a8d2d51f38c6aa272c6ab26b34 — William Clarke 2 years ago a48c500
SEO FTW! Add sitemap / robots.txt
1 files changed, 12 insertions(+), 0 deletions(-)

M ssssg
M ssssg => ssssg +12 -0
@@ 39,6 39,14 @@ main() {

    cp -R src/css/. dst/css/.

    # copy over the robots.txt file if there is one.
    test -f src/robots.txt && cp src/robots.txt dst/robots.txt

    # create a super-simple sitemap of all html files.
    for file in dst/**/*.html; do
        add_to_sitemap "$file"
    done

    echo "Generated $(find dst | wc -l) files"
}



@@ 121,6 129,10 @@ generate_rss_feed() {
    echo "</channel></rss>"
}

add_to_sitemap() {
    echo "$1" | sed -e "s;dst;$(config_for base_url);" >> dst/sitemap.txt
}

date_func() {
    if [ "$(uname)" = "Darwin" ]; then
        gdate || echo "Please 'brew install coreutils'" && exit 1