Move alternate button into a helper for reuse

includes auto-lookup of mime type for requested format