MVC 多租户站点 - 自定义每个租户的元标签
我正在尝试解决我的多租户应用程序面临的另一个问题。
我的网站上有很多页面,我需要为每个租户的每个页面自定义元标记/页面标题。
存储这些元标签的最佳位置在哪里?我无法再使用 ContentPlaceHolder,因为它仅适用于单个租户。
目前我已经将它们放入数据库中,如下所示:
MetaTags
- Url
- Title
- Description
- Keywords
但是,这似乎有点僵化,因为 Url 字段与当前请求路径匹配,但请求路径可能并不总是匹配:
这工作正常:
DB Url: /media/latest/
Request Path: /media/latest/
这不可以
DB Url: /media/latest/
Request Path: /media/latest/1 (page number)
任何人为此想到更好的设计/技术吗?
谢谢, 保罗
I'm trying to get my head around another issue i'm facing with my multi-tenant application.
I have many pages on my site where I need to customise the meta tags / page titles for each of my pages per tenant.
Where would be the best place to store these meta tags? I can't use a ContentPlaceHolder any more because that would only work for a single tenant.
At the moment I have got them in the DB like so:
MetaTags
- Url
- Title
- Description
- Keywords
However this seems a little rigid because the Url field matches the current request path, but the request path might not match all the time:
This works fine:
DB Url: /media/latest/
Request Path: /media/latest/
This doesn't
DB Url: /media/latest/
Request Path: /media/latest/1 (page number)
Can anyone think of a better design / technique for this?
Thanks,
Paul
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我修改了代码以使用控制器名称和操作名称而不是 URL,这使事情变得更加容易...我还在每个租户的应用程序启动时缓存所有元标记。
I modified my code to use the controller name and action name instead of the URL which is making things alot easier...I am also caching all the meta tags on application startup for each tenant.