So I'm basically trying to make profile pages. I have a JavaScript file with an object in it, which contains all of the "users" (it's a school project so these are fake users I created myself). I also have an HTML page where I listed all of these users (I'm using a combination of Jekyll, Handlebars and JavaScript). Under each user profile picture, I added a button which should link to a detail page for each user. Like so:
<p><a class="btn btn-default" href="profile.html?id={{id}}" role="button">View details »</a></p>
This works fine and every user has its own page. My problem is, I have no idea how to show user specific content since I (have to) use the same page (profile.html).
This is how I listed out all users:
<script id="users-template" type="text/x-handlebars-template">
{% raw %}
{{#each this}}
<div class="col-md-3">
<div class="user">
<img src="{{picture}}" class="profpic"/>
<h4>{{firstName}} {{surName}}</h4>
<p><a class="btn btn-default" href="profile.html?id={{id}}" role="button">View details »</a></p>
</div>
</div>
{{/each}}
{% endraw %}
</script>
Is there a way to use handlebars to select only one of these users and show the content on that page? And also how do I make sure that my new page knows which user ID I'm currently viewing? Any help would be appreciated.