Showing only 4 items at a time

So this is an html partial template from my theme:

{{ "<!-- Portfolio Grid Section -->" | safeHTML }}
<section id="news" class="bg-light-gray">
  <div class="container">
    <div class="row">
      <div class="col-lg-12 text-center">
        <h2 class="section-heading">{{ with }}{{ . | markdownify }}{{ end }}</h2>
        <h3 class="section-subheading text-muted">{{ with }}{{ . | markdownify }}{{ end }}</h3>
    <div class="row">

      {{ range }}
        <div class="col-md-4 col-sm-6 portfolio-item">
          <div class="portfolio-caption">
            <h4>{{ .title | markdownify }}</h4>
          <a href="#newsModal{{ .modalID }}" class="portfolio-link" data-toggle="modal">
            <div class="portfolio-hover">
              <div class="portfolio-hover-content">
                <i class="fa fa-plus fa-3x"></i>
            {{ $url := printf "img/news/%s" .preview }}
            <img src="{{ $url | absURL }}" class="img-responsive" alt="">
      {{ end }}


What I want to do is only have it show the 4 latest news items on the page.

However, if I do, for example {{ range last 4 }} I get ERROR: 2017/01/17 15:15:31 general.go:236: theme/partials/news.html is an incomplete or empty template

Any ideas what I’m doing wrong?