One eZ Publish best practice is storing static strings or ids as settings variables loaded in templates instead of storing static strings or ids within templates.
You should review your template files and move these static strings or ids into a settings file and make reference to the custom settings variables you define.
This example should show clearly a basic example of how to store your custom variable contents within a settings file and access them in a template.