FlatPress 1.4-dev Github 1908 - Problem with meta-tags

For devs and testers: Tests of current development versions, technical details of the code.
Post Reply
laborix
Posts: 151
Joined: Sat Feb 16, 2019 3:51 pm

FlatPress 1.4-dev Github 1908 - Problem with meta-tags

Post by laborix » Fri Mar 07, 2025 4:45 pm

Nginx 1.27 and PHP 8.1.31 environment

Either I'm too stupid or FlatPress 1.4-dev Github 1908 has a fatal flaw?
If I create a new post with meta description/keyword tags and meta noindex,nofollow checked, these meta tags do not show up when displaying the source code in the frontend?
Error or stupidity?

When editing the post, you can fill in or check these meta tags under the post. After editing the post again, they are filled in and checked, only the frontend does not want to?
Completely deleting the cache from the web browser used, as well as manually deleting the compile folder content on the web space, does not bring any improvement.
Has this ever been tested? :roll:

Edit:
The file "entry..._metatags.ini" is available and there all the infos are correct. Has the SEO-Plugin a problem with Nginx?

best regards

User avatar
fraenkiman
Posts: 368
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: FlatPress 1.4-dev Github 1908 - Problem with meta-tags

Post by fraenkiman » Fri Mar 07, 2025 9:19 pm

Hello Laborix,

take a look at hw-helpers.php in the inc directory. Lines 150 to 168, where some server variables are queried. It is possible that NGINX does not provide valid values. The function currentPageURL is needed for the output of the meta tags.

Best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

User avatar
fraenkiman
Posts: 368
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: FlatPress 1.4-dev Github 1908 - Problem with meta-tags

Post by fraenkiman » Fri Mar 07, 2025 9:53 pm

Possible replacement function, which also takes load balancers and reverse proxies into account.

Code: Select all

if (!function_exists('currentPageURL')) {

	function currentPageURL() {

		$protocol = is_https() ? "https" : "http";

		$port = $_SERVER ['SERVER_PORT'];
		if (!empty($_SERVER ['HTTP_X_FORWARDED_PORT'])) {
			$port = $_SERVER ['HTTP_X_FORWARDED_PORT'];
		}

		$portString = (!in_array($port, ["80", "443"])) ? ":" . $port : "";

		$curpageURL = $protocol . "://" . $_SERVER ["SERVER_NAME"] . $portString . $_SERVER ["REQUEST_URI"];

		return $curpageURL;
	}
}
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

User avatar
fraenkiman
Posts: 368
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: FlatPress 1.4-dev Github 1908 - Problem with meta-tags

Post by fraenkiman » Fri Mar 07, 2025 10:09 pm

Possible NGINX configuration:

Code: Select all

server {
    listen 80;
    server_name example.com;

    location / {
        proxy_pass http://localhost:8080; # Forwarding to the PHP server
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
    }
}
Without guarantee, as I do not use NGINX.
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

laborix
Posts: 151
Joined: Sat Feb 16, 2019 3:51 pm

Re: FlatPress 1.4-dev Github 1908 - Problem with meta-tags

Post by laborix » Sat Mar 08, 2025 10:17 am

Please also close this thread, problem situation is solved.

If you call up the blog directly, i.e. all posts are visible, no meta tags are in the source code listed. If you then switch to a entry, i.e. only this entry is displayed, then the meta tags are present in the source code. It was my mistake, nothing thinking before posting :oops:

Hint:
You should explain in the instructions for the SEO plugin that only this entry gets these meta tags and only if you only read this entry.
The whole thing is independent of the web server, whether Apache or Nginx

best regards

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests