I've made this modest CMS in PHP (and Zend Framework).
The content of a page of the published website is stored in a MySQL TEXT field. When editing the content of a page, one is able to create links to other internal pages within the website.
The pages slugs (SEO uri's) are also editable in the CMS.
What is a good way to synchronize internal links in content, when a page's slug that is linked to is altered by the end-user of the CMS?
I welcome solutions, from simple and robust solutions (without too much refactoring of the database), to more complex and flexible, that need some refactoring of the database and such. What are some good ideas to handle this?
Thanks in advance.
PS.:
It doesn't have to be specified in PHP/MySQL. Just the global concept will probably do fine, unless it is something obscure that PHP/MySQL is unable to handle of course.
Here's how some content management systems approach it, and in general it seems to be the best balance as far as runtime performance, edit-time performance, and manageability:
Keep a table of pages and links:
|PageID |LinksToID |
|----------|-------------|
|1 |2 |
|1 |3 |
When you store page (foo), find all the links in that page (not very intensive), find where each one links to (trivial, since of course you have your pages indexed by URL, right?).
Populate this table with that info (page 1 has links to pages 2 and 3).
When page 3 is renamed, go back to this table and pull all pages that link to it; search their content for URLs to page 3, replace and update.
No runtime impact, and the edit-time impact is optimized. And you get a handy, easy-to-query map of all the cross-links in your site. Bonus!
Option 1:
Search the content for slug URLs when inserting/updating content, and store them in a table that relates slug urls to their id's, and to the content id. ('slug_content_map')
You can then add a method that replaces the old slug URL with the new slug URL in the content when the URL is updated, if the content has an entry in 'slug_content_map'.
Option 2:
When inserting/updating content, replace slug URLs with a string such as {slugId:3} , and then replace that dynamically when displaying the content.
This method has more overhead when displaying the content as you'd have to lookup the slug to replace it.
Related
TYPO3 7.6.16 ext:news 5.3.2
We're looking to create a json stream of news stories that have been created in the CMS so that we can consume the feed in other applications. For each element in the feed we're looking include some simple properties such as the news story name, when it was published and a link to the news story, so that we can direct someone back to the relevant page on the Website.
We've been able to return a list of news stories by querying the tx_news_domain_model_news table. From this table we've been able to query all the information that we need from the story, but we're having trouble building a link to the story.
The links that the news plugin is building for each story at the moment takes the form:
/story/tx_news_pi1%5Bnews%5D=18&tx_news_pi1%5Bcontroller%5D=News&tx_news_pi1%5Baction%5D=detail&cHash=a6e542381e508c0501a09383cedc4d70.
So the id field of the news story field is included as a parameter. We've tried making links by adjusting this parameter for the various Ids of different news stories, but each link allways returns the same news item. So we are assuming that the hash value for each nwes story has to be calculated for each item to find the correct story.
Our question is. Is it possible to build a unique URL for each story based on the information in the tx_news_domain_model_news table or is there a better way to create a JSON feed for each news story which includes the link to the original article.
You could define a special page rendering. either a new page or a new pagetype of an existing page.
You use a page object and instead of the usual include of a template the whole content is generated by a CONTENT object. With this you select all news records and define a renderobject where you can use FLUIDTEMPLATE or build up the rendering in typoscript.
In this way you can generate 'normal' URLs, which also might be niced by realurl.
If you want to output other formats than HTML you propably need to escape string-delimiters in your texts and strings.
Fluid templates may be a little bit complex if you have a format where whitespace is important. In typoscript whitespace can be handled with stdWrap.noTrimWrap
it is possible to have a direct path to a special news entry?
example:
my link is: http://www.domain.de/start/topnewsdetail/news/really-long-name-of-news-entry.html
and it would be nice to have
http://www.domain.de/newsEntry.html.
Can someone give a hint?
it is a little bit complicated if you want a general automatic solution.
you can do it by hand if you insert pages of type 'external url' where you insert the long path as external url.
with realurl you have problems as realurl at least will use one path segment for the page with the detail view before the last segment which is for identifying the news record. AFAIK coolurl can ommit the path segemnt for the page.
on the other hand: make sure the news identification (title, subtitle?) is unique and does not collide with pathes for normal pages.
at last you can use .htaccess rewrites, but that needs to differentiate between short urls for news and short urls for top-level pages. So those urls will show the page, those urls are not generated inside of TYPO3 and so nowhere used (except manual)
this EXT. adds a custom link to records like system category or news:
https://typo3.org/extensions/repository/view/recordlink
It'S deployed for TYPO3 6.2 but perhabs it'S helpful to create an own EXT.?
Is it possible to automatically redirect a Redmine wiki page to another page?
I mean a mechanism similar to Wikipedia's "redirected from..." so I can assign different titles to the same page (with one of them being the main one).
I've just tried it with Redmine 3.1.0. You need access to the database. It's not that complicated, though it is not official.
Insert one line per redirect into the table wiki_redirects. You need the wiki id, which is the project id in normal cases. To find the id look into the wikis table.
Insert:
id: (should be set by the database system)
wiki_id: From which wiki should be redirected (is likely the same as wiki_id if redirecting takes place in a single wiki, and not across projects)
title: The not existing page name from which will be redirected
created_on: some date (I wouldn't use one which is in the future...)
redirects_to: the target page name
redirects_to_wiki_id: the target wiki id
Since your working in the database you have to maintain the entries there. Modifications and deletions have to be done there as well.
I have coded my ASP.NET MVC application in a way that allows stored entities to be retrieved via a friendly name in the URL, for example:
www.mysite.com/artists/james-brown/songs
Where james-brown is a URL friendly string stored on my Artist entity.
Now imagine I add an artist that no one has heard of before, and no one ever navigated to that artist's songs page.
How would Google/Yahoo/Other Search Engines know that my site does indeed have songs for that unknown artist.
Do I create a sitemap and maintain it through code as I add / remove artists?
There are few defined known ways to make the new links visible to search engine world.
XML and HTML Sitemap:
Add it to sitemap and submit it through webmaster tools.
HTML sitemaps are another way to achieve it. If your site has footer sitemap, you can add it to them.
Internal Links
Create internal links from your high ranking pages or highly crawled pages to the new pages. Google and other search engines tend to crawl pages where the content changes frequently. So if you have a refreshed content pages, try adding it to those pages and chances are high for those pages to be discovered quickly.
External Links
Create links from external blogs, company blogs and sites like pagetube.org which can help it to be discovered.
Yeah just add them to either sitemap, internal or even external links
I am working on a major site migration for alpinezone.com . As part of that migration, I moved all the news articles from vbulletin into wordpress cms. The vbulletin articles were previousyl pulled out via a plugin called GARS.
In any event, I have 3400 news articles over the course of five years or so. They are presently in the following format:
news.alpinezone.com/12345
If the title of the news article was "Sugarloaf Sets World Record" then the new location will be
alpinezone.com/sugarloaf-sets-world-record/
Is there a way for me to automate creating the necessary redirects that take the title from the literal page 12345 and convert into a URL?
Finally; the additional trick is that since I did a VB upgrade the existing news articles no longer show up. So going to news.alpinezone.com/12345 won't show anything right now, you need to pull up the forum thread (which is typically hidden) by taking that identifier and going to http://forums.alpinezone.com/showthread.php?12345 to see the actual title. I can pull all this from the WP database, (since all the posts are from a user AlpineZone News).
Any ideas? I'm fairly new to this and the added complexity of subdomains is somethign I am trying to figure out. Thx!
you could make your own showthread.php file in the correct location it was previously located.
have it use the passed id, retrieve the associated record from your database.
Construct the new url by turning the title to lowercase and changing spaces to - and do a redirect via header('Location: new url here');