plugin wp seo yoast – Fixing link rel=”next” in for paginated links

I’ve got a site with yoast seo running, as seen in the source:

<title>Redacted</title>
<meta name="description" content="Redacted" />
<meta name="robots" content="index, follow" />
<meta name="googlebot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" />
<meta name="bingbot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" />
<link rel="canonical" href="Redacted" />
<link rel="next" href="Redacted.com/page/2/" />
<meta property="og:locale" content="en_US" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Redacted" />
<meta property="og:description" content="Redacted" />
<meta property="og:url" content="Redacted" />
<meta property="og:site_name" content="Redacted" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@Redacted" />
<!-- / Yoast SEO plugin. -->

However, where I have – it should actually be /index.php/page/2. That’s fine, I go to fix it.

However for the life of me I can’t work out where it’s setting it. It’s nowhere to be found in the Yoast plugin tools. I tried searching for the text across all plugins (comes up way too much to be useful).

I tried the yoast online documentation but they mostly talk about how meta tags aren’t used any more, and more about what canonical and next do, rather than how or where to set them.

Any advice appreciated on how to remedy this.

CSOM Caml queries only get root-level folders in the document library (paginated answer)

I can easily access the rootFolders of my test library on SharePoint Online

FolderCollection oFolderCollection = targetList.RootFolder.Folders;
clientContext.Load(oFolderCollection);
clientContext.ExecuteQuery();

The problem is that this doesn't work for my production library because it exceeds the view list threshold. I was able to work around the threshold error with the following code:

using (ClientContext clientContext = new ClientContext(webUri))
        {

            int rowLimit = 1;
            var camlQuery = new CamlQuery();
            camlQuery.ViewXml = @"" + rowLimit + "";

            clientContext.Credentials = new SharePointOnlineCredentials(userName, password);
            ListItemCollectionPosition position = null;

            // This value is NOT List internal name
            List targetList = clientContext.Web.Lists.GetByTitle("Clients");

            //1st attempt
            //FolderCollection oFolderCollection = targetList.RootFolder.Folders;
            //clientContext.Load(oFolderCollection);
            //clientContext.ExecuteQuery();

            int clientCount = 0;
            do
            {
                ListItemCollection listItems = null;
                camlQuery.ListItemCollectionPosition = position;
                listItems = targetList.GetItems(camlQuery);
                clientContext.Load(listItems);
                clientContext.ExecuteQuery();
                position = listItems.ListItemCollectionPosition;
                items.AddRange(listItems.ToList());

                foreach (ListItem item in listItems)
                {
                    if (item != null && item.Folder != null)
                    {
                        try
                        {
                            clientContext.Load(item);
                            clientContext.Load(item.Folder);
                            clientContext.Load(item.Folder.ParentFolder);
                            clientContext.ExecuteQuery();
                            if ((item != null && item.Folder != null) && item.Folder.GetType() == typeof(Folder))
                            {
                                clientCount++;



                                //currently getting all files and folders, just want to start at top level folder then load in others if/as needed
                                Console.WriteLine(clientCount + "- Client: " + item.Folder.Name);
                                //clientFileDiver(item.Folder, clientContext);

                            }
                        }
                        catch (Microsoft.SharePoint.Client.ServerException)
                        {
                            if(item == null || item.Folder == null)
                            {
                                continue;
                            }
                            throw;
                        }
                        catch (ServerObjectNullReferenceException)
                        {
                            if (item == null || item.Folder == null)
                            {
                                continue;
                            }
                        }
                        catch (Exception)
                        {
                            throw;
                        }

                    }

                }

            }
            while (position != null);

Try to ignore some of the ugly if statements: D. I'm very new to CSOM and Caml. Is it possible to write a caml statement that only returns the folders in the root of the document library? Or is there a way to change the original way I tried and restore the folders in a paginated response using the targetList.Rootfolder properties? Sorry if this is unclear! Happy Friday everyone!

Sharepoint Online Csom: A paginated answer shows a maximum of 5000 views in the document library

Let me anticipate this. I asked them to reorganize the files in many different ways, but they like to look at all the files in one place.

I'm working on cleaning up a large document library for my company. The library in question has a total of almost 1 million objects. Only at the root view level do we have over 6000 client folders, and that is expected to grow. I'm trying to add these client folders to my CSOM console application to just determine if the folders contain files, and if not, we'll delete them. Simple enough, isn't it? It works well on a small test library with 20 clients. The problem is that I can't even see our actual production library. When I point the following code to the production library, I only get the dreaded "Exceeds 5000 Limit". I have learned that there is no way around this on the administrator side as you could on a SharePoint server. I'm trying to get 1 client folder at a time with a Caml query, but even that causes problems. Is what I do possible or not? Code below:

 using (ClientContext clientContext = new ClientContext(webUri))
            {

                int rowLimit = 1;
                var camlQuery = new CamlQuery();
                camlQuery.ViewXml = @"" + rowLimit + "";

                clientContext.Credentials = new SharePointOnlineCredentials(userName, password);
                ListItemCollectionPosition position = null;

                // This value is NOT List internal name

                List targetList = clientContext.Web.Lists.GetByTitle("Clients");
                   // FolderCollection oFolderCollection = targetList.RootFolder.Folders;
                   // clientContext.Load(oFolderCollection);
                    //clientContext.ExecuteQuery();
                do
                {
                    ListItemCollection listItems = null;
                    camlQuery.ListItemCollectionPosition = position;
                    listItems = targetList.GetItems(camlQuery);
                    clientContext.Load(listItems);
                    clientContext.ExecuteQuery();
                    position = listItems.ListItemCollectionPosition;
                    items.AddRange(listItems.ToList());

                    foreach (ListItem item in listItems)
                    {
                        clientContext.Load(item);
                        clientContext.Load(item.Folder);
                        clientContext.ExecuteQuery();
                        if(item.Folder.GetType() == typeof(Folder))
                        {
                            Console.WriteLine(item.Folder.GetType());
                            Console.WriteLine(item.Folder.Name);
                            Console.ReadKey();
                        }

                    }

                }
                while (position != null);
}

When I referenced our production library, I encountered the threshold error on clientContext.Load (listItems);

How do I cut a paginated view in jinja2 django?

I have this paginated generic ListView

class ShoseListView(generic.ListView):
model = Shose
context_object_name = "Shose_list"
template_name = "products/listings.html"
paginate_by = 8

I want to cut it in two and use it, but there is a problem with the slice

     {% for shose in Shose_list|slice(4) %}

Template Syntax Error
Two arguments are required for slice, of which 1 is specified

even though I read the jinja documentation
his job well with an argument

wordpress – google indexes my post as a paginated post

I recently found out that Google indexes part of my post as pagination. mydomain.com/post/page/2 Meanwhile, my posts are not paginated. So, if you enter the URL listed above, which is indexed in the Google search console, it will automatically be redirected to mydomain.com/post.
My question is how to stop this because the page / 2 + does not exist in the true sense

paging – Paginated Ajax form with non-SQL data

With Drupal 8 I have created a form to load data from a web service with Ajax below the form. Now I'm trying to add pagination to the result, but the paginator was not loading, am I doing something wrong? I've tried to follow the guide from https://www.drupal.org/docs/7/creating-custom-modules/howtos/paging-non-sql-data, but it's for Drupal 7. Thanks in advance ,

Here is my code:

$ response contains an array of data from the web service.

$ total contains the record of the results

//number of records per page
$num_per_page = 3;
//get current page
$current_page = pager_default_initialize($total, $num_per_page);
$chunks = array_chunk($response, $num_per_page);
$current_page_items = $chunks($current_page);
foreach ($current_page_items as $i => $item) {
  $current_page_items($i) = array(
    '#theme' => 'ajax_search',
    '#item' => $item,
  );
}

// Generate the render array for our page
$render_array('page') = array (
  '#theme' => 'item_list',
  '#items' => $current_page_items,
);
// Calls Drupal standard pager theme and set 5 page links on pager
$render_array('pager') = array (
  '#theme' => 'pager',
  '#quantity' => 5,
);

$response = new AjaxResponse();
$response->addCommand(
  new HtmlCommand(
    '.result_message',
    $render_array)
  );
return $response;

8 – Paginated form with Ajax check box triggers: The specified # ajax callback is empty or unavailable

Using Drupal 8.7.7 I have a form that consists of a paginated user table.

Each user line contains a checkbox in the form to which an Ajax event is attached. Essentially, this allows me to save the selection in the user's session as they select users and switch to other pages.

The form works properly on the first page. However, if you switch to the second page, only the first selection works. Each selection made afterwards triggers the error:

Symfony Component HttpKernel Exception HttpException: The specified # ajax callback is empty or can not be called. in Drupal Core Form FormAjaxResponseBuilder-> buildResponse () (line 67 of /var/www/html/web/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php).

Here is the content of buildForm:

public function buildForm(array $form, FormStateInterface $form_state) {
    /** @var SymfonyComponentHttpFoundationSessionSession $session */
    $session = $this->requestStack->getCurrentRequest()->getSession();
    /** @var DrupalnodeEntityNode $node */
    $node = $this->requestStack->getCurrentRequest()->get('node');
    if (!$session->has($node->id().'_register_selection')) {
      $this->requestStack->getCurrentRequest()->getSession()->set($node->id().'_register_selection', ());
    } else {
      $selected = $session->get($node->id().'_register_selection');
    }

    $form('selected_users') = (
      '#type' => 'container',
      '#attributes' => ('id' => 'selected-users'),
    );

    $users = $form_state->getValue('user_list');
    if (!empty($users)) {
      foreach ($users as $user) {
        if ($user('check') == TRUE) {
          $selected($user('uid')) = $user('uid');
        } elseif (array_key_exists($user('uid'), $users)) {
            unset($selected($user('uid')));
        }
        $session->set($node->id() . '_register_selection', $selected);
      }
    }

    if (!empty($selected)) {
      foreach ($selected as $item) {
        $form('selected_users')($item)('user') = (
          '#type' => 'item',
          '#markup' => t('user: @user', ('@user' => $item)),
          '#weight' => '0',
        );
      }
    }

    $header = (
      ('data' => $form('user_list')('check_all') = (
          '#type' => 'checkbox',
          '#title' => t('Select all'),
          '#return_value' => TRUE,
          '#wrapper_attributes' => (
            'class' =>('align-middle', 'm-0')
          )
        ),
        'class'=> ('py-4')
      ),
      'uid' => ('data' => t('UID'), 'class'=> ('align-middle', 'py-4')),
      'username' => ('data' => t('Username'), 'class'=> ('align-middle', 'py-4')),
      'sits_id' => ('data' => t('SITS ID'), 'class'=> ('align-middle', 'py-4')),
      'name' => ('data' => t('Name'), 'class'=> ('align-middle', 'py-4')),
      'mail' => ('data' => t('Email'), 'class'=> ('align-middle', 'py-4')),
      'college' => ('data' => t('College'), 'class'=> ('align-middle', 'py-4')),
      'programme' => ('data' => t('Programme'), 'class'=> ('align-middle', 'py-4')),
      'course' => ('data' => t('Course'), 'class'=> ('align-middle', 'py-4')),
      'year' => ('data' => t('Year'), 'class'=> ('align-middle', 'py-4')),
    );

    $form('user_list') = (
      '#type' => 'table',
      '#header' => $header,
      '#empty' => t('No users found with the selected filters.'),
      '#prefix' => "
", '#suffix' => "
", '#attributes' => ( 'class' => ('table-sm'), 'style' => 'font-size: .85rem', ) ); $query = $this->database->select('users_field_data', 'ufd'); $query->leftJoin('profile', 'profile', 'profile.uid = ufd.uid'); $query->leftJoin('profile__field_prof_sits_id', 'sitsid', 'sitsid.entity_id = profile.profile_id'); $query->leftJoin('profile__field_prof_first_name', 'fname', 'fname.entity_id = profile.profile_id'); $query->leftJoin('profile__field_prof_last_name', 'lname', 'lname.entity_id = profile.profile_id'); $query->leftJoin('profile__field_prof_college', 'college', 'college.entity_id = profile.profile_id'); $query->leftJoin('profile__field_prof_programme', 'programme', 'programme.entity_id = profile.profile_id'); $query->leftJoin('profile__field_prof_course', 'course', 'course.entity_id = profile.profile_id'); $query->leftJoin('profile__field_prof_sits_year', 'year', 'year.entity_id = profile.profile_id'); $query->fields('ufd', ('uid','name', 'mail')); $query->addField('sitsid', 'field_prof_sits_id_value', 'sits_id'); $query->addField('fname', 'field_prof_first_name_value', 'first_name'); $query->addField('lname', 'field_prof_last_name_value', 'last_name'); $query->addField('college', 'field_prof_college_target_id', 'college_gid'); $query->addField('programme', 'field_prof_programme_target_id', 'programme_gid'); $query->addField('course', 'field_prof_course_target_id', 'course_gid'); $query->addField('year', 'field_prof_sits_year_value', 'year'); $query->extend('DrupalCoreDatabaseQueryTableSortExtender')->orderByHeader($header); $pager = $query->extend('DrupalCoreDatabaseQueryPagerSelectExtender')->limit(10); $results = $pager->execute()->fetchAll(); if ($results) { foreach ($results as $data) { $form('user_list')($data->uid)('check') = ( '#type' => 'checkbox', '#ajax' => ( 'callback' => '::processUser', 'wrapper' => 'selected-users', ), '#wrapper_attributes' => ( 'class' => ('align-middle', 'm-0', 'p-0', 'text-align-center') ), '#attributes' => ( 'class' => ('m-0'), 'style' => 'position:relative;', ), '#default_value' => isset($selected($data->uid)) ? TRUE : FALSE, ); $form('user_list')($data->uid)('uid') = ( '#type' => 'item', '#markup' => $data->uid, '#value' => $data->uid, '#weight' => '0', '#wrapper_attributes' => ( 'class' => ('align-middle', 'm-0') ) ); $form('user_list')($data->uid)('username') = ( '#type' => 'item', '#markup' => $data->name, '#value' => $data->name, '#weight' => '0', '#wrapper_attributes' => ( 'class' => ('align-middle', 'm-0') ) ); $form('user_list')($data->uid)('sits_id') = ( '#type' => 'item', '#markup' => $data->sits_id, '#value' => $data->sits_id, '#weight' => '0', '#wrapper_attributes' => ( 'class' => ('align-middle', 'm-0') ) ); $form('user_list')($data->uid)('name') = ( '#type' => 'item', '#markup' => $data->first_name . ' ' . $data->last_name, '#value' => $data->first_name . ' ' . $data->last_name, '#weight' => '0', '#wrapper_attributes' => ( 'class' => ('align-middle', 'm-0') ) ); $form('user_list')($data->uid)('mail') = ( '#type' => 'item', '#markup' => $data->mail, '#value' => $data->mail, '#weight' => '0', '#wrapper_attributes' => ( 'class' => ('align-middle', 'm-0') ) ); $form('user_list')($data->uid)('college') = ( '#type' => 'item', '#markup' => $data->college_gid, '#value' => $data->college_gid, '#weight' => '0', '#wrapper_attributes' => ( 'class' => ('align-middle', 'm-0') ) ); $form('user_list')($data->uid)('programme') = ( '#type' => 'item', '#markup' => $data->programme_gid, '#value' => $data->programme_gid, '#weight' => '0', '#wrapper_attributes' => ( 'class' => ('align-middle', 'm-0') ) ); $form('user_list')($data->uid)('course') = ( '#type' => 'item', '#markup' => $data->course_gid, '#value' => $data->course_gid, '#weight' => '0', '#wrapper_attributes' => ( 'class' => ('align-middle', 'm-0') ) ); $form('user_list')($data->uid)('year') = ( '#type' => 'item', '#markup' => $data->year, '#value' => $data->year, '#weight' => '0', '#wrapper_attributes' => ( 'class' => ('align-middle', 'm-0') ) ); } } $form('actions') = ( '#type' => 'actions', '#attributes' => ( 'class' => ('mb-4', 'd-flex', 'justify-content-center') ) ); $form('actions')('submit') = ( '#type' => 'submit', '#value' => $this->t('Register'), '#name' => 'update', ); $form('pager') = ('#type' => 'pager'); return $form; } }

And the processUser callback:

  public function processUser(array &$form, FormStateInterface $form_state) {
    return $form('selected_users');
  }

This seems to work correctly without pagination. However, if you enable pagination, it will be interrupted. Has anyone experienced that?

Website Design – Enables users to select large items to export from a paginated list

On a website I design, users have access to a search facility that lists items with potentially much content (they are meant to be grammar exercises so that each item has several grammatical issues). The current view uses pagination (6 elements per page) and looks like this:

Enter image description here

Users should be able to select in a special mode the items to be exported to a file. While there might be hundreds of elements and multiple results pages, I'd like the design to be usable on no more than 40-50 elements, and suggest limiting the search query if the result set is larger.

So I have a problem: users can select items to export from a list that does not fit on a single page because the items are so large. While there are many questions (1, 2, 3) and solutions to selecting items from a long list, these items are typically small, simple text captions of one to two words in length, in this case list authors or a grid-based one Layout with checkboxes can be used; this is impractical.

The solution I was thinking about was to switch from pagination to infinite scrolling and then, if the user clicked the Export button, load all elements from the server if the user had not scrolled down, and then simply allow individual items to be selected via checkboxes (ie a box next to each item will be displayed, if the item is to be exported, the box should be checked).

  • Are there any significant disadvantages to this approach? One problem I can see is that over 10 elements are likely to scroll a lot, due to the height of each element. How big is the problem?
  • Is there any other solution I could consider?
  • I think my solution should work on mobile as well, with nothing more than checkboxes required. Are there any difficulties I miss?