A good place to start is teaching her to check in with you frequently, even without a command.
A good way of doing that is carrying treats with you around the house, and whenever she looks at you or comes to you to see what you are up to, praise her and give her a reward. She will quickly learn to check in with you frequently, which will get her a reward. (Eventually, phase the reward out and use praise.)
If you want her to stay with you while walking off-leash, this method works well because she will turn to look at you every so often and also stick close. When she looks at you, you can give her a command or redirect her when you need to - sit, down, stay, come, etc. are commands you may need to use on a trail while hiking off leash.
The first couple of times you work with her outside on checking in with you, as well as on the trail, I would recommend doing it on a long line or drag leash. (If you let her drag a leash or line, make sure she doesn't go off where you can no longer step on the line to stop her ... *lol* ... otherwise the whole drag leash is a moot point.) Praise and reward her for sticking close and checking in.
This is what worked for us, pretty much. Abby gets to have some room when we hike (if we're in a place that allows it and isn't busy) and she checks in frequently and stays close. I can call her back to a heel (walking nicely next to me - not an obedience heel) or have her stop and down if there's need because she's within ear shot and checks in with me.
We don't hike off leash if it's an area that sees a lot of people. I've found that a lot of hikers don't appreciate off-leash dogs on the trail, even if they behave extremely well. Some people just aren't dog people.