Unify duplicate codes regarding content attribute