Template:If in category/doc

{	"params": { "1": {			"aliases": [ "page" ],			"label": "Page", "description": "Page being checked", "type": "wiki-page-name", "required": true },		"2": {			"aliases": [ "category" ],			"label": "Category", "description": "Category being checked to see if the page is in it; do not include the prefix", "type": "wiki-page-name", "required": true },		"3": {			"aliases": [ "yes" ],			"label": "If yes", "description": "Output if the page is in the category", "type": "content", "suggested": true },		"4": {			"aliases": [ "no" ],			"label": "If no", "description": "Output if the page is not in the category", "type": "content", "suggested": true }	},	"description": "Checks whether a page is in a category, and returns different output based on the answer." }

Example
produces.

Limitations
This template is very expensive.

Only detects categories directly on a page, not those added indirectly through templates.