Clean tags #1585

Closed
opened 2020-08-31 11:33:15 +00:00 by max.mehl · 1 comment
Owner

As one can see on our tags page, we have a lot of rather useless tags that should be cleaned:

  • tags for only 1-2 articles are useless (unless they are for recently started campaigns)
  • sometimes more than one tag covers the same issue (e.g. women/feminism or annual-report/annualreport)
  • tags like "2013" are completely senseless IMHO
  • unify way how we write tags: CamelCase'ed tags seem to appear duplicated on the tags page (is this a bug?)

I propose to make a rigorous cleanup of such tags. This is a task which can be shared by multiple people if they coordinate well.

Some tools

To make finding, deleting, or replacing tags easier, I collect a few bash lines which automate things:

Finding files containing a tag

tag=article
git grep -li "<tag.*key=\"$tag\""

Replacing a tag with another

Requirement: install git-sed (see my blog about this tool)

oldtag=heartbleed
newtag=security
git sed -f gi "(<tag.*key=\")$oldtag(\")" "\1$newtag\2"

Here, you should take care that the newtag is not already a tag of the file.

(Committed as db51a77622)

Deleting a tag

tag=aa
for file in $(git grep -li "<tag.*key=\"$tag\""); do sed -i "/<tag.*key=\"$tag\"/Id" $file; done

(Committed as 31d860725a)

As one can see on our [tags page](https://fsfe.org/tags/tags.html), we have a lot of rather useless tags that should be cleaned: * tags for only 1-2 articles are useless (unless they are for recently started campaigns) * sometimes more than one tag covers the same issue (e.g. women/feminism or annual-report/annualreport) * tags like "2013" are completely senseless IMHO * unify way how we write tags: CamelCase'ed tags seem to appear duplicated on the tags page (is this a bug?) I propose to make a rigorous cleanup of such tags. This is a task which can be shared by multiple people if they coordinate well. ## Some tools To make finding, deleting, or replacing tags easier, I collect a few bash lines which automate things: ### Finding files containing a tag ``` tag=article git grep -li "<tag.*key=\"$tag\"" ``` ### Replacing a tag with another Requirement: install git-sed (see [my blog about this tool](https://mehl.mx/blog/2020/the-power-of-git-sed/)) ``` oldtag=heartbleed newtag=security git sed -f gi "(<tag.*key=\")$oldtag(\")" "\1$newtag\2" ``` Here, you should take care that the newtag is not already a tag of the file. (Committed as https://git.fsfe.org/FSFE/fsfe-website/commit/db51a7762242ba941cadfa049172768b7f132d5c) ### Deleting a tag ``` tag=aa for file in $(git grep -li "<tag.*key=\"$tag\""); do sed -i "/<tag.*key=\"$tag\"/Id" $file; done ``` (Committed as https://git.fsfe.org/FSFE/fsfe-website/commit/31d860725a8623d119482c79b8ea1d236acbecec)
Member

I suggest that we write tags like we would write HTML identifiers: all lowercase with a dash (-) separating words if that is helpful for readability. For example, "koalition-freies-wissen" rather than "KoalitionFreiesWissen" or "koalitionfreieswissen".

I suggest that we write tags like we would write HTML identifiers: all lowercase with a dash (-) separating words if that is helpful for readability. For example, "koalition-freies-wissen" rather than "KoalitionFreiesWissen" or "koalitionfreieswissen".
max.mehl self-assigned this 2020-09-12 10:09:15 +00:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: FSFE/fsfe-website#1585