Greetings, i want to remove the parenthesis and change the placeholders (name and email) fields in the Portal to make it cleaner, is this possible?
Thanks!
Greetings, i want to remove the parenthesis and change the placeholders (name and email) fields in the Portal to make it cleaner, is this possible?
Thanks!
You haven’t said what you are trying to do, but if you just want to change that it says there, you can inject this code. Remove “(Save 17%)” withwhatever you want there.
portgal-discount is the class to target
<script>
document.addEventListener("DOMContentLoaded", function() {
document.querySelectorAll('[class*="portal-discount"]').forEach(el => {
el.textContent = "Save 17%";
});
});
</script>
I’d be surprised if that worked, since Portal runs in an iframe and that text isn’t necessarily there when the page first loads.
@hackermade My experience is that there’s not a super straightforward way to edit text within the portal, unless you want to edit and build a custom copy. (Which is not too bad to do, but you’d need to keep your custom copy updated with your Ghost version, when Ghost makes changes that impact it.)
Why an open source project restrict some part of it in that way?
You’re not restricted. Fork the source code, make your edits, and then build your custom version of portal. (Works anywhere, directions for how will vary with hosting environment.)
Will i have any issue with update and change in the future? I use Docker with the official Ghost image btw
So I wouldn’t build all of Ghost from source, just the portal app. (The readme in apps/portal was somewhat helpful, IIRC.)
Then you’d put the built app somewhere (within the theme files works), and you’d set the portal URL within your Ghost config to load it from that URL instead of the default. See Configuration - Ghost Developer Docs - but you might need to translate that to portal__url if using environment variables. ![]()
Will you have to update in the future? Yes. The Ghost team doesn’t change the interface between portal and and the Ghost API all that often, but it does happen (for example, when integrity tokens went in, and I know there are one time codes on the way). But since you self host, you’d presumably just sync your fork, rebuild portal and get it deployed, and pull the Ghost container, so that everything stayed in sync. I suspect that’s a 15 minute job once you get the hang of it, and you certainly don’t have to do it every week – you could wait until Ghost released a feature or bug fix you wanted, and then do it.
Another option if you’re just changing some text would be to skip all the building and just grab a copy of already minified portal, find and replace the strings, and then change your portal.url setting as above. That skips needing a whole Ghost development environment set up.