8 – Dynamic meta tags and description in custom pages

I have a custom Drupal module that generates pages for players on my site. The Player Statistics data is updated most of the time. For the sake of usability, I have created a custom module for the player pages.

I have an external database where all player information is stored. My module defines a URL pattern and displays the player's information from the external database upon receipt of the pattern.

My problem is that I was unable to display meta tags and descriptions for my player pages because there is no actual node for my pages. I tried meta tags module and meta tag route modules. However, with these modules I could only define one static meta tag and one description for my entire module, ie there is only one meta description for all pages. I want them to be dynamic and vary from page to page. I've tried the following examples, but I can only add static strings. I want the player to get a wise meta description.

Generate Meta in Drupal 8 Controller

In Drupal 8, add a meta tag to the head

Here is my code structure.

player.info.yml

name: Player Module
description: Creates Page for Player.
package: Custom
type: module
version: 1.0
core: 8.x

player.module

 (
      'variables' => ('result' => NULL),
      'template' => 'player-page-formatter',
    ),
  );
}

player.routing.yml

player:
  path: '/player/{player}'
  defaults:
    _controller: 'DrupalplayerControllerPlayerController::content'
    _title_callback: 'DrupalplayerControllerPlayerController::title' 
  requirements:
    _permission: 'access content'

PlayerController.php

 'player_page_data',
      '#result' => $result,
      '#cache' => ('max-age' => 0),
    );

  }

  public function title($player) {
    $title = "";
    /* --------------
     code logic here 
    ------------------ */
    return (
      '#type' => 'markup',
      '#markup' => $title,
    );
  }

}

I'm stuck with this topic for a long time. Every help is appreciated.

PHP – Implement AJAX to retrieve pages or posts in a custom WordPress design

I like using Ajax to get the content of a WordPress page in my custom templates. I have read that it is necessary to forward the entire call to retrieve or retrieve data about admin-ajax.php from WordPress. I am a bit confused as to how to proceed. For example, if I want to retrieve the content of a post because I want to display it, I need to set up a call to admin ajax or a call to a function file that contains the post content. PHP Query? Someone leads me.

Sorry for the stupid question, I've never used Ajax in my custom themes or in WordPress in general.
first I try to use that get_template_part() Function to load custom HTML code and WP loops, but not suitable for certain themes or app themes where Ajax is smoother and more user-friendly.

An example of my code:







// here fetch the content inside a div instead of using the loop directly



Is the REST API a good approach?

Javascript – How to change pages through NodeJS?

Well, I tried to switch pages by pressing Enter, but I get the error: "path must be absolute or root for res.sendFile".

My folder structure:

Enter image description here

HTML form (index.html):

  

routes.js:

//var AlunoDao = require('../app/aluno-dao');
var conexao = require('../config/custom-mssql');

module.exports = (app) => {
    app.get('/', (req, res) => {
        res.sendFile('dashboard.html');
    });
    app.post('/login', (req, res) => {
        console.log("FUNCIONOU");
        res.sendFile('index.html');
    });
}

custom-express.js:

const express = require('express');
const app = express();

const bodyParser = require('body-parser');
//const expressLayouts = require('express-ejs-layouts');

const rotas = require('../app/rotas.js');


// informar o express que vamos usar o EJS como engine de visualização
//app.set('view engine', 'ejs');

// informar o express que vamos usar os módulos relacionados às variaveis abaixo
//app.use(expressLayouts);
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.static(__dirname + '/views'));
app.use(express.static(__dirname + '/public'));
app.use(express.static('public')); 
app.use(express.static('views')); 
app.use(bodyParser.json());

//acrescentando informacoes de cabecalho para suportar o CORS
app.use(function(req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
    res.header("Access-Control-Allow-Methods", "GET, POST, HEAD, OPTIONS, PATCH, DELETE");
    next();
  });

// passar como parâmetro para o módulo rotas.js
rotas(app);

module.exports = app;

If you enter "localhost: 3000", the file index.html (working) will be loaded. After pressing the Enter key, it is taken over into the app.post (…) method, but can not render the dashboard.html file. I tried replacing res.sendFile (& 39; index.html & # 39;) with res.sendFile (& dashboard.html & # 39;), and index.html continues to render. How is that possible?

Design System – How does Angular ViewEncapsulation affect the maintenance of web pages and styles?

So we have a developer team that deals with Angular, and thus ViewEncapsulation.

This means that when you create an Angular component, you add the styling to the component instead of using the global CSS. Depending on the ViewEncapsulation mode, the CSS will be output either in the header or in HTML as an inline style.

We have a design system and want to create a library of reusable angle components.

During my years developing websites, the mantra was: inline styling is bad!
I do not know if this still applies today as the browsers become more advanced.

My arguments for not encapsulating styling in Angular components are:

  • Inline Styling makes HTML documents larger and thus slower in loading
  • When the Angular component reads a CSS file when it loads a page, additional HTTP requests are created, slowing down the page load again
  • Maintaining a style guide is difficult if you do not have control over the components you are using
  • Similar components can be made different, since this is done by different developers. This can change the behavior of the components.

Does anyone have experience with styling in Angular components while managing a design system?

facebook – Apps for managing social media pages

I'm looking for a good social media management app (preferably free) that can be used by a small team.

Basically, an app that allows for a single manager account linked to all of our social media sites (Twitter, Instagram, and Facebook), so everyone in the team can calendar / manage posts and see each other's work through their various devices.

Any suggestions?

terminal – man -k and apropos can not find pages in section 3 in Catalina

For example, run apropos printf:

Printf(3o)               - Formatted output functions
Stdlib.Printf(3o)        - no description
gprintf(1), printf(1)    - format and print data
format(ntcl)             - Format a string in the style of sprintf
fwkpfv(1)                - FireWire kprintf viewer
printf(1)                - formatted output
xprintf(5)               - extensible printf

printf(3) is not listed, but man 3 printf can find this manpage.

In the meantime stderr issues many mistakes like this one:

makewhatis: /usr/lib/libgcc_s.1.dylib: Not a directory

What should I do to do apropos and man -k work properly?

views – The context filter does not work with wildcard path pages

I'm stuck on something. I have a view with a path with a wildcard "/ the-register /%". I want to use the context filter to filter by taxonomy term id or name. But if I add a contextual filter "Taxonomyterm ID" with a fixed value of 1, it will be displayed well in the preview, but if I go to the page, does not it show anything?

I use Drupal 8.7.8. It also occurs in Drupal 8.7.6.