User:Jtraulle/DiscourseMigration: Difference between revisions

m
(→‎Permalinks: Add permalink logic for direct links to posts)
Tag: 2017 source edit
Tag: 2017 source edit
Line 446: Line 446:
# Javascript detect that the current URL have a # part
# Javascript detect that the current URL have a # part
# Using Javascript, we redirect to the permalink https://test-dolibarr-discourse.traulle.net/forum/old-post/113400 that redirects to https://test-dolibarr-discourse.traulle.net/forum/t/wiki-dolibarr-org/27878/227
# Using Javascript, we redirect to the permalink https://test-dolibarr-discourse.traulle.net/forum/old-post/113400 that redirects to https://test-dolibarr-discourse.traulle.net/forum/t/wiki-dolibarr-org/27878/227
=====Javascript part=====
This code is to paste in the <code>Admin → Customize → Themes → Light → Edit CSS/HTML → Common → </head></code> section.
<source lang="HTML">
<script type="text/javascript">
var urlSplit = document.URL.split("#");
if (urlSplit[1]) {
    location.href = "/forum/old-post/" + urlSplit[1];
}
</script>
</source>


===Ads===
===Ads===