HTML: Links über rel-Attribut absichern

Wenn du auf eine externe Webseite verlinkst und über target="_blank" festlegst, dass die Seite in einem neuen Tab geöffnet werden soll, wird empfohlen zusätzlich das Attribut rel="noopener noreferrer" zu setzen:

<a href="https://lgk.io" target="_blank" rel="noopener noreferrer">Klick</a>

Snippet für Visual Studio Code

Snippets in Visual Studio Code sind Shortcuts um vorgefertigte Code-Schnipsel einzufügen.

Hier die Snippet-Konfig für target="_blank" rel="noopener noreferrer":

{
	...
	"Secure target blank": {
		"prefix": "target=\"_blank\" rel=\"noopener noreferrer\"",
		"body": "target=\"_blank\" rel=\"noopener noreferrer\""
	}
}

Mehr Infos zu Snippets in Visual Studio Code.

Guide: Use Git for deployment

Prepare server

  1. Use SSH to get to webspace: ssh user@webspace.host
  2. Navigate to correct directory: cd myapp/production
  3. Create Git folder: mkdir .git
  4. Navigate to the folder: cd .git
  5. Init bare repository: git init --bare
  6. Create file called „post-receive“ in .git/hooks with this content:
#!/bin/sh

# The production directory
TARGET="/kunden/homepages/xx/xxx/htdocs/myapp/production/app"

# The Git repo
REPO="/kunden/homepages/xx/xxx/htdocs/myapp/production/.git"
# Deploy the content to the directory
git --work-tree=$TARGET --git-dir=$REPO checkout -f

Update: It’s important that your „post-receive“ file has the permission to execute. In my case, I gave the file permission 705.

Prepare local development setup

  1. Project folder has to be a Git repository. If it isn’t already, run: git init
  2. Add remote: git remote add deploy ssh://user@webspace.host/kunden/homepages/xx/xxx/htdocs/myapp/production/.git

Upload changes

  1. Commit local changes.
  2. Run this to upload them: git push deploy HEAD